From 4ce6b07886450a1f75eecc02b62bc91970de61cf Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 18 Dec 2014 15:59:16 +0000 Subject: [PATCH] From Mattias Helsing, "CMake have release 3.0 and 3.1 and we have some bad checks for cmake major version when settings cmake policies in CMakeLists.txt. This fixes it" git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14620 16af8721-9629-0410-8352-f15c8da7e697 --- CMakeLists.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d618eefa..0db1adb18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,25 +22,30 @@ if(COMMAND cmake_policy) # tell CMake to prefer CMake's own CMake modules when available # only available from cmake-2.8.4 - if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3) + if(${CMAKE_MAJOR_VERSION} GREATER 2 OR + (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR + (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3)) cmake_policy(SET CMP0017 NEW) endif() # cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names # quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below." - if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0) + if(${CMAKE_MAJOR_VERSION} GREATER 2 OR + (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 6) OR + (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6 AND ${CMAKE_PATCH_VERSION} GREATER 0)) cmake_policy(SET CMP0008 OLD) endif() # disable autolinking to qtmain as we have our own main() functions (new in Qt 5.1) - if((${CMAKE_MAJOR_VERSION} EQUAL 2 OR ${CMAKE_MAJOR_VERSION} GREATER 2) AND - (${CMAKE_MINOR_VERSION} EQUAL 8 OR ${CMAKE_MINOR_VERSION} GREATER 8) AND - ${CMAKE_PATCH_VERSION} GREATER 10) + if(${CMAKE_MAJOR_VERSION} GREATER 2 OR + (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR + (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 9)) cmake_policy(SET CMP0020 OLD) endif() # nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements? #if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10) - + # or even easier (available in cmake-2.6) + #if(POLICY CMPxyzw) endif()