Fancify README with Markdown, build status, links
[quassel.git] / CMakeLists.txt
index 778864e..03ac969 100644 (file)
@@ -11,8 +11,8 @@ project(QuasselIRC)
 # Versions
 set(QUASSEL_MAJOR  0)
 set(QUASSEL_MINOR 12)
-set(QUASSEL_PATCH  3)
-set(QUASSEL_VERSION_STRING "0.12.3")
+set(QUASSEL_PATCH  4)
+set(QUASSEL_VERSION_STRING "0.12.4")
 
 # We want to know CMake's version for debug reasons
 message(STATUS "Using CMake ${CMAKE_VERSION}")
@@ -127,10 +127,15 @@ endif()
 
 # Setting COMPILE_DEFINITIONS_<CONFIG> 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)