mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 21:00:17 -06:00
Tests for 'CheckIPOSupported' module
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
4
Tests/RunCMake/CheckIPOSupported/CMakeLists.txt
Normal file
4
Tests/RunCMake/CheckIPOSupported/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(CheckIPOSupported)
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
9
Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
Normal file
9
Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
Normal file
@@ -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)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)$
|
||||
1
Tests/RunCMake/CheckIPOSupported/default-lang-none.cmake
Normal file
1
Tests/RunCMake/CheckIPOSupported/default-lang-none.cmake
Normal file
@@ -0,0 +1 @@
|
||||
check_ipo_supported()
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)$
|
||||
@@ -0,0 +1,3 @@
|
||||
project(${RunCMake_TEST} LANGUAGES C)
|
||||
set(_CMAKE_IPO_SUPPORTED_BY_CMAKE NO)
|
||||
check_ipo_supported()
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)$
|
||||
@@ -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()
|
||||
22
Tests/RunCMake/CheckIPOSupported/save-to-result.cmake
Normal file
22
Tests/RunCMake/CheckIPOSupported/save-to-result.cmake
Normal file
@@ -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()
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)$
|
||||
@@ -0,0 +1 @@
|
||||
check_ipo_supported(RESULT result OUTPUT output xxx)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)$
|
||||
1
Tests/RunCMake/CheckIPOSupported/user-lang-fortran.cmake
Normal file
1
Tests/RunCMake/CheckIPOSupported/user-lang-fortran.cmake
Normal file
@@ -0,0 +1 @@
|
||||
check_ipo_supported(LANGUAGES "Fortran")
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)$
|
||||
1
Tests/RunCMake/CheckIPOSupported/user-lang-unknown.cmake
Normal file
1
Tests/RunCMake/CheckIPOSupported/user-lang-unknown.cmake
Normal file
@@ -0,0 +1 @@
|
||||
check_ipo_supported(LANGUAGES UnknownLanguage)
|
||||
Reference in New Issue
Block a user