cmake: check for policy CMP0077 existence

Check `if(POLICY CMP0077)` before trying to set it, because setting a
policy a version of cmake does not know about is an error.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-03-26 13:40:35 +00:00
parent ae38a70d1e
commit f2e9dc5530
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,10 @@
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW) # link to full path of libs
cmake_policy(SET CMP0005 NEW) # escapes in add_definitions
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW) # use vars for options
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
cmake_policy(SET CMP0043 NEW) # for wxWidgets, use generator expressions

View File

@ -3,7 +3,10 @@
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW) # link to full path of libs
cmake_policy(SET CMP0005 NEW) # escapes in add_definitions
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW) # use vars for options
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
cmake_policy(SET CMP0043 NEW) # for wxWidgets, use generator expressions