Handle CMake CMP0024
authorLuís Pereira <luis.artur.pereira@gmail.com>
Fri, 24 Nov 2017 12:14:27 +0000 (12:14 +0000)
committerAlf Gaida <agaida@siduction.org>
Fri, 8 Dec 2017 23:01:00 +0000 (00:01 +0100)
CMP0024 OLD behavior will be deprecated.

cmake/sysstat-config.cmake.in

index d8218c6..88be366 100644 (file)
@@ -15,8 +15,9 @@ set(SYSSTAT_VERSION       @SYSSTAT_VERSION@)
 include(CMakeFindDependencyMacro)
 
 find_dependency(Qt5Core @QT_MINIMUM_VERSION@)
-
-if (CMAKE_VERSION VERSION_GREATER 2.8.12)
-    cmake_policy(SET CMP0024 OLD)
+if (NOT TARGET @SYSSTAT_LIBRARY_NAME@)
+    if (POLICY CMP0024)
+        cmake_policy(SET CMP0024 NEW)
+    endif()
+    include("${CMAKE_CURRENT_LIST_DIR}/@SYSSTAT_LIBRARY_NAME@-targets.cmake")
 endif()
-include("${CMAKE_CURRENT_LIST_DIR}/@SYSSTAT_LIBRARY_NAME@-targets.cmake")