diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CheckIPOSupported.cmake | 15 | ||||
-rw-r--r-- | Modules/CheckIPOSupported/CMakeLists-C.txt.in | 2 | ||||
-rw-r--r-- | Modules/CheckIPOSupported/CMakeLists-CXX.txt.in | 2 | ||||
-rw-r--r-- | Modules/Platform/Linux-Intel.cmake | 1 |
4 files changed, 17 insertions, 3 deletions
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake index 55c8901..31c1bd3 100644 --- a/Modules/CheckIPOSupported.cmake +++ b/Modules/CheckIPOSupported.cmake @@ -28,6 +28,9 @@ property. Specify languages whose compilers to check. Languages ``C`` and ``CXX`` are supported. +It makes no sense to use this module when :policy:`CMP0069` is set to ``OLD`` so +module will return error in this case. See policy :policy:`CMP0069` for details. + Examples ^^^^^^^^ @@ -125,7 +128,17 @@ macro(_ipo_run_language_check language) endmacro() function(check_ipo_supported) - # TODO: IPO policy + cmake_policy(GET CMP0069 x) + + string(COMPARE EQUAL "${x}" "" not_set) + if(not_set) + message(FATAL_ERROR "Policy CMP0069 is not set") + endif() + + string(COMPARE EQUAL "${x}" "OLD" is_old) + if(is_old) + message(FATAL_ERROR "Policy CMP0069 set to OLD") + endif() set(optional) set(one RESULT OUTPUT) diff --git a/Modules/CheckIPOSupported/CMakeLists-C.txt.in b/Modules/CheckIPOSupported/CMakeLists-C.txt.in index d20f31f..5a3b8ee 100644 --- a/Modules/CheckIPOSupported/CMakeLists-C.txt.in +++ b/Modules/CheckIPOSupported/CMakeLists-C.txt.in @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION "@CMAKE_VERSION@") project("@TRY_COMPILE_PROJECT_NAME@" LANGUAGES C) -# TODO: IPO policy +cmake_policy(SET CMP0069 NEW) add_library(foo foo.c) add_executable(boo main.c) diff --git a/Modules/CheckIPOSupported/CMakeLists-CXX.txt.in b/Modules/CheckIPOSupported/CMakeLists-CXX.txt.in index 4b55c70..30993fa 100644 --- a/Modules/CheckIPOSupported/CMakeLists-CXX.txt.in +++ b/Modules/CheckIPOSupported/CMakeLists-CXX.txt.in @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION "@CMAKE_VERSION@") project("@TRY_COMPILE_PROJECT_NAME@" LANGUAGES CXX) -# TODO: IPO policy +cmake_policy(SET CMP0069 NEW) add_library(foo foo.cpp) add_executable(boo main.cpp) diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake index 45dc36f..6e2978a 100644 --- a/Modules/Platform/Linux-Intel.cmake +++ b/Modules/Platform/Linux-Intel.cmake @@ -39,6 +39,7 @@ macro(__linux_compiler_intel lang) "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> " "${XIAR} -s <TARGET> ") set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) + set(_CMAKE_IPO_LEGACY_BEHAVIOR YES) else() set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) endif() |