diff options
author | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2017-03-11 11:56:00 (GMT) |
---|---|---|
committer | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2017-03-21 14:38:53 (GMT) |
commit | 6c8326749fccd37afd5343d926d650c87ecdfb9f (patch) | |
tree | ad5d4429bed6a16b2e918476f98cf2e084c23483 | |
parent | fdb2ba2521998397d97d466b10a8ac2458363625 (diff) | |
download | CMake-6c8326749fccd37afd5343d926d650c87ecdfb9f.zip CMake-6c8326749fccd37afd5343d926d650c87ecdfb9f.tar.gz CMake-6c8326749fccd37afd5343d926d650c87ecdfb9f.tar.bz2 |
Tests for 'CheckIPOSupported' module
22 files changed, 89 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5157b9f..217f0d5 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -293,6 +293,7 @@ add_RunCMake_test(target_link_libraries) add_RunCMake_test(target_compile_features) add_RunCMake_test(CheckModules) +add_RunCMake_test(CheckIPOSupported) add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(CommandLineTar) diff --git a/Tests/RunCMake/CheckIPOSupported/CMakeLists.txt b/Tests/RunCMake/CheckIPOSupported/CMakeLists.txt new file mode 100644 index 0000000..a0effc9 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(CheckIPOSupported) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake new file mode 100644 index 0000000..e304c61 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +run_cmake(unparsed-arguments) +run_cmake(user-lang-unknown) +run_cmake(user-lang-fortran) +run_cmake(default-lang-none) +run_cmake(not-supported-by-cmake) +run_cmake(not-supported-by-compiler) +run_cmake(save-to-result) diff --git a/Tests/RunCMake/CheckIPOSupported/default-lang-none-result.txt b/Tests/RunCMake/CheckIPOSupported/default-lang-none-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/default-lang-none-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt b/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt new file mode 100644 index 0000000..dc2c3ad --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): + IPO is not supported \(no C/CXX/Fortran languages found in ENABLED_LANGUAGES + global property\)\. +Call Stack \(most recent call first\): + .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) + default-lang-none\.cmake:[0-9]+ \(check_ipo_supported\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckIPOSupported/default-lang-none.cmake b/Tests/RunCMake/CheckIPOSupported/default-lang-none.cmake new file mode 100644 index 0000000..0a2ac69 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/default-lang-none.cmake @@ -0,0 +1 @@ +check_ipo_supported() diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-result.txt b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-stderr.txt b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-stderr.txt new file mode 100644 index 0000000..f63f30f --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): + IPO is not supported \(CMake doesn't support IPO for current compiler\)\. +Call Stack \(most recent call first\): + .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) + not-supported-by-cmake\.cmake:[0-9]+ \(check_ipo_supported\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake.cmake b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake.cmake new file mode 100644 index 0000000..6f61f7e --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-cmake.cmake @@ -0,0 +1,3 @@ +project(${RunCMake_TEST} LANGUAGES C) +set(_CMAKE_IPO_SUPPORTED_BY_CMAKE NO) +check_ipo_supported() diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-result.txt b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt new file mode 100644 index 0000000..73e2f26 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): + IPO is not supported \(compiler doesn't support IPO\)\. +Call Stack \(most recent call first\): + .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) + not-supported-by-compiler\.cmake:[0-9]+ \(check_ipo_supported\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler.cmake b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler.cmake new file mode 100644 index 0000000..652cfd5 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler.cmake @@ -0,0 +1,4 @@ +project(${RunCMake_TEST} LANGUAGES C) +set(_CMAKE_IPO_SUPPORTED_BY_CMAKE YES) +set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) +check_ipo_supported() diff --git a/Tests/RunCMake/CheckIPOSupported/save-to-result.cmake b/Tests/RunCMake/CheckIPOSupported/save-to-result.cmake new file mode 100644 index 0000000..f76db72 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/save-to-result.cmake @@ -0,0 +1,22 @@ +project(${RunCMake_TEST} LANGUAGES C) +check_ipo_supported(RESULT result OUTPUT output) + +string(COMPARE EQUAL "${result}" "" is_empty) +if(is_empty) + message(FATAL_ERROR "Result variable is empty") +endif() + +string(COMPARE EQUAL "${result}" "YES" is_yes) +string(COMPARE EQUAL "${result}" "NO" is_no) + +if(is_yes) + # Compiler supports IPO +elseif(is_no) + # Compiler doesn't support IPO, output should not be empty. + string(COMPARE EQUAL "${output}" "" is_empty) + if(is_empty) + message(FATAL_ERROR "Output is empty") + endif() +else() + message(FATAL_ERROR "Unexpected result: ${result}") +endif() diff --git a/Tests/RunCMake/CheckIPOSupported/unparsed-arguments-result.txt b/Tests/RunCMake/CheckIPOSupported/unparsed-arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/unparsed-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckIPOSupported/unparsed-arguments-stderr.txt b/Tests/RunCMake/CheckIPOSupported/unparsed-arguments-stderr.txt new file mode 100644 index 0000000..a3fee53 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/unparsed-arguments-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): + Unparsed arguments: xxx +Call Stack \(most recent call first\): + unparsed-arguments\.cmake:[0-9]+ \(check_ipo_supported\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckIPOSupported/unparsed-arguments.cmake b/Tests/RunCMake/CheckIPOSupported/unparsed-arguments.cmake new file mode 100644 index 0000000..3ee7326 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/unparsed-arguments.cmake @@ -0,0 +1 @@ +check_ipo_supported(RESULT result OUTPUT output xxx) diff --git a/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-result.txt b/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-stderr.txt b/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-stderr.txt new file mode 100644 index 0000000..2cb595d --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): + IPO is not supported \(Fortran is not supported\)\. +Call Stack \(most recent call first\): + .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) + user-lang-fortran\.cmake:[0-9]+ \(check_ipo_supported\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckIPOSupported/user-lang-fortran.cmake b/Tests/RunCMake/CheckIPOSupported/user-lang-fortran.cmake new file mode 100644 index 0000000..275dbd9 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/user-lang-fortran.cmake @@ -0,0 +1 @@ +check_ipo_supported(LANGUAGES "Fortran") diff --git a/Tests/RunCMake/CheckIPOSupported/user-lang-unknown-result.txt b/Tests/RunCMake/CheckIPOSupported/user-lang-unknown-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/user-lang-unknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckIPOSupported/user-lang-unknown-stderr.txt b/Tests/RunCMake/CheckIPOSupported/user-lang-unknown-stderr.txt new file mode 100644 index 0000000..278ba0b --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/user-lang-unknown-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): + IPO is not supported \(language\(s\) 'UnknownLanguage' not supported\)\. +Call Stack \(most recent call first\): + .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) + user-lang-unknown\.cmake:[0-9]+ \(check_ipo_supported\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckIPOSupported/user-lang-unknown.cmake b/Tests/RunCMake/CheckIPOSupported/user-lang-unknown.cmake new file mode 100644 index 0000000..ac743ad --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/user-lang-unknown.cmake @@ -0,0 +1 @@ +check_ipo_supported(LANGUAGES UnknownLanguage) |