X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=CMakeLists.txt;h=03ac969ef5bc8013ca940ded687a72cb766b654b;hp=4a84373c24f3f7124e52075b61f3afa8eaf83089;hb=7e95ff801372a9707ecf9e7a32e74d7f5d55f118;hpb=90183eeb030dd4dda32e4f107e8bcf13f393388d diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a84373c..03ac969e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,10 +127,15 @@ endif() # Setting COMPILE_DEFINITIONS_ is deprecated since CMake 3.0 in favor of generator expressions. # These have existed since CMake 2.8.10; until we depend on that, we have to explicitly enable the old policy. -if (CMAKE_MAJOR_VERSION GREATER 2) +if (POLICY CMP0043) cmake_policy(SET CMP0043 OLD) endif() +# Honor visibility settings for all target types +if (POLICY CMP0063) + cmake_policy(SET CMP0063 NEW) +endif() + # Simplify later checks ##################################################################### @@ -231,7 +236,7 @@ if (USE_QT5) PURPOSE "Enable support for the snorenotify framework" ) endif() - + if (WITH_WEBKIT) find_package(Qt5WebKit QUIET) @@ -428,6 +433,11 @@ endif() cmake_push_check_state(RESET) set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES} ${Qt5Core_INCLUDE_DIRS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + +if (USE_QT5 AND Qt5_POSITION_INDEPENDENT_CODE) + set(CMAKE_REQUIRED_FLAGS "-fPIC -DQT_NO_VERSION_TAGGING") +endif() + check_cxx_source_compiles(" #include \"qglobal.h\" #if defined QT_NO_SSL @@ -572,6 +582,16 @@ include(GetGitRevisionDescription) get_git_head_revision(GIT_REFSPEC GIT_HEAD) git_describe(GIT_DESCRIBE --long) +# If in a Git repo we can get the commit-date from a git command +if (GIT_HEAD) + execute_process( + COMMAND git show -s --format=%ct + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +endif() + # If not in a Git repo try to read GIT_HEAD and GIT_DESCRIBE from # enviroment if (NOT GIT_HEAD OR NOT GIT_DESCRIBE) @@ -587,6 +607,7 @@ endif() if (NOT GIT_HEAD OR NOT GIT_DESCRIBE) set(GIT_HEAD "") set(GIT_DESCRIBE "") + set(GIT_COMMIT_DATE 0) endif() configure_file(version.h.in ${CMAKE_BINARY_DIR}/version.h @ONLY)