jimbraun / XCDF

XCDF: eXplicitly Compacted Data Format. See documentation at Read the Docs:
https://xcdf.readthedocs.io/en/latest/
Other
14 stars 8 forks source link

Configure errors with cmake 2.8.12.2 #84

Closed fwerner closed 7 years ago

fwerner commented 7 years ago

CentOS 6.8 provides cmake 2.8.12.2 which fails to configure the current XCDF master:

CMake Error at CMakeLists.txt:31 (CMAKE_POLICY):
  Policy "CMP0026" is not known to this version of CMake.

CMake Error at CMakeLists.txt:32 (CMAKE_POLICY):
  Policy "CMP0042" is not known to this version of CMake.

This is due to the following check in CMakeLists.txt which, I guess, wass meant to identify cmake 3:

  IF ("${CMAKE_VERSION}" VERSION_GREATER 2.8.12)
    CMAKE_POLICY(SET CMP0026 OLD)  # Read LOCATION properties from build targets
    CMAKE_POLICY(SET CMP0042 OLD)  # Disable @rpath in target install name
  ENDIF()

Simple patch:

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@ ENDIF ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
 IF (COMMAND cmake_policy)
   CMAKE_POLICY(SET CMP0009 NEW)  # Do not follow symlinks w/ FILE_GLOB_RECURSE

-  IF ("${CMAKE_VERSION}" VERSION_GREATER 2.8.12)
+  IF ("${CMAKE_VERSION}" VERSION_GREATER 2.8.12.2)
     CMAKE_POLICY(SET CMP0026 OLD)  # Read LOCATION properties from build targets
     CMAKE_POLICY(SET CMP0042 OLD)  # Disable @rpath in target install name
   ENDIF()

But most likely only the major version of cmake should be checked instead of the full version string.

jimbraun commented 7 years ago

Thanks, this was lazy on my part. It is easy enough to check version >= 3. I've committed the change.