Browse Source

CheckIPOSupported: Visual Studio and Xcode generators do not support IPO

Ruslan Baratov 8 years ago
parent
commit
e05835c35b

+ 6 - 1
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()
 

+ 4 - 0
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()

+ 1 - 1
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\)

+ 1 - 0
Tests/RunCMake/CheckIPOSupported/not-supported-by-generator-result.txt

@@ -0,0 +1 @@
+1

+ 6 - 0
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\)$

+ 6 - 0
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()