diff options
Diffstat (limited to 'Tests/RunCMake/CheckIPOSupported')
9 files changed, 42 insertions, 0 deletions
diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-Common.cmake b/Tests/RunCMake/CheckIPOSupported/CMP0138-Common.cmake new file mode 100644 index 0000000..508e6c3 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-Common.cmake @@ -0,0 +1,9 @@ +enable_language(C) +string(APPEND CMAKE_C_FLAGS " -DFOO") +string(APPEND CMAKE_C_FLAGS_DEBUG " -DBAR") +check_ipo_supported(RESULT ipo_supported) +file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/_CMakeLTOTest-C/bin/CMakeCache.txt" + cached_flags REGEX "^CMAKE_C_FLAGS(_DEBUG)?:") +foreach(line IN LISTS cached_flags) + message(STATUS "${line}") +endforeach() diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW-stdout.txt b/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW-stdout.txt new file mode 100644 index 0000000..aa150a8 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW-stdout.txt @@ -0,0 +1,5 @@ +-- CMAKE_C_FLAGS:STRING=[^ +]*-DFOO +-- CMAKE_C_FLAGS_DEBUG:STRING=[^ +]*-DBAR +-- diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW.cmake b/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW.cmake new file mode 100644 index 0000000..6611504 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0138 NEW) +include(CMP0138-Common.cmake) diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stdout.txt b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stdout.txt new file mode 100644 index 0000000..c80b208 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stdout.txt @@ -0,0 +1,3 @@ +-- CMAKE_C_FLAGS:STRING=([^-]|-[^D]|-D[^F]|-DF[^O]|-DFO[^O])* +-- CMAKE_C_FLAGS_DEBUG:STRING=([^-]|-[^D]|-D[^B]|-DB[^A]|-DBA[^R])* +-- diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD.cmake b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD.cmake new file mode 100644 index 0000000..b16ac9f --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0138 OLD) +include(CMP0138-Common.cmake) diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN-stdout.txt b/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN-stdout.txt new file mode 100644 index 0000000..c80b208 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN-stdout.txt @@ -0,0 +1,3 @@ +-- CMAKE_C_FLAGS:STRING=([^-]|-[^D]|-D[^F]|-DF[^O]|-DFO[^O])* +-- CMAKE_C_FLAGS_DEBUG:STRING=([^-]|-[^D]|-D[^B]|-DB[^A]|-DBA[^R])* +-- diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN.cmake b/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN.cmake new file mode 100644 index 0000000..01118ee --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN.cmake @@ -0,0 +1,2 @@ +# (leave CMP0138 unset) +include(CMP0138-Common.cmake) diff --git a/Tests/RunCMake/CheckIPOSupported/Inspect.cmake b/Tests/RunCMake/CheckIPOSupported/Inspect.cmake new file mode 100644 index 0000000..07e4258 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/Inspect.cmake @@ -0,0 +1,5 @@ +enable_language(C) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" " +set(_CMAKE_C_IPO_SUPPORTED_BY_CMAKE \"${_CMAKE_C_IPO_SUPPORTED_BY_CMAKE}\") +set(_CMAKE_C_IPO_MAY_BE_SUPPORTED_BY_COMPILER \"${_CMAKE_C_IPO_MAY_BE_SUPPORTED_BY_COMPILER}\") +") diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake index b7d524c..2fb159e 100644 --- a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake @@ -1,5 +1,8 @@ include(RunCMake) +run_cmake(Inspect) +include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake") + run_cmake(unparsed-arguments) run_cmake(user-lang-unknown) run_cmake(default-lang-none) @@ -8,6 +11,14 @@ run_cmake(not-supported-by-compiler) run_cmake(save-to-result) run_cmake(cmp0069-is-old) +if(_CMAKE_C_IPO_SUPPORTED_BY_CMAKE + AND _CMAKE_C_IPO_MAY_BE_SUPPORTED_BY_COMPILER + AND NOT RunCMake_GENERATOR MATCHES "^Visual Studio 9 ") + run_cmake(CMP0138-WARN) + run_cmake(CMP0138-OLD) + run_cmake(CMP0138-NEW) +endif() + if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ") run_cmake(not-supported-by-generator) endif() |