diff options
6 files changed, 24 insertions, 2 deletions
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake index 6f7bc82..55c8901 100644 --- a/Modules/CheckIPOSupported.cmake +++ b/Modules/CheckIPOSupported.cmake @@ -203,7 +203,12 @@ function(check_ipo_supported) endif() if(NOT _CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER) - _ipo_not_supported("compiler doesn't support IPO") + _ipo_not_supported("Compiler doesn't support IPO") + return() + endif() + + if(CMAKE_GENERATOR MATCHES "^(Visual Studio |Xcode$)") + _ipo_not_supported("CMake doesn't support IPO for current generator") return() endif() diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake index e304c61..2815037 100644 --- a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake @@ -7,3 +7,7 @@ run_cmake(default-lang-none) run_cmake(not-supported-by-cmake) run_cmake(not-supported-by-compiler) run_cmake(save-to-result) + +if(RunCMake_GENERATOR MATCHES "^(Visual Studio |Xcode$)") + run_cmake(not-supported-by-generator) +endif() diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt index 73e2f26..5f5f410 100644 --- a/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-compiler-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): - IPO is not supported \(compiler doesn't support IPO\)\. + 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\) diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator-result.txt b/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator-stderr.txt b/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator-stderr.txt new file mode 100644 index 0000000..a2aa58c --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator-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 generator\)\. +Call Stack \(most recent call first\): + .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) + not-supported-by-generator\.cmake:[0-9]+ \(check_ipo_supported\) + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator.cmake b/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator.cmake new file mode 100644 index 0000000..dc0fa09 --- /dev/null +++ b/Tests/RunCMake/CheckIPOSupported/not-supported-by-generator.cmake @@ -0,0 +1,6 @@ +project(${RunCMake_TEST} LANGUAGES C) + +set(_CMAKE_IPO_SUPPORTED_BY_CMAKE YES) +set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) + +check_ipo_supported() |