CMake: Update for 3.1 compatibility

CMake 3.1's if() by default now interprets quoted variable names as
strings. This is a good idea from a strictness perspective, so make it
do this even if we're in 2.8.9 compatibility mode.
issue1247
Nicolas Hake 2015-01-18 15:25:09 +01:00
parent fad70eb204
commit 2b2d70d02a
2 changed files with 8 additions and 1 deletions

View File

@ -13,6 +13,13 @@
cmake_minimum_required (VERSION 2.8.9)
project (openclonk CXX C)
# CMP0054: Only interpret if() arguments as variables or keywords when unquoted
# (since CMake 3.1)
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(Version.txt)

View File

@ -45,7 +45,7 @@
#=============================================================================
macro(CHECK_INCLUDE_FILES_CXX INCLUDE VARIABLE)
if("${VARIABLE}" MATCHES "^${VARIABLE}$")
if(NOT DEFINED "${VARIABLE}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")