summaryrefslogtreecommitdiffstats
path: root/Modules/CheckIPOSupported.cmake
diff options
context:
space:
mode:
authorRuslan Baratov <ruslan_baratov@yahoo.com>2017-03-09 13:05:19 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-30 18:56:46 (GMT)
commit1588a577d16cfb1a689a444b1db1df3ccff2cc3d (patch)
tree1c4e4a60729202be6992079fc41501d736caefb2 /Modules/CheckIPOSupported.cmake
parenta75757004bda0ff32a152a0d9d6379c02b1338ce (diff)
downloadCMake-1588a577d16cfb1a689a444b1db1df3ccff2cc3d.zip
CMake-1588a577d16cfb1a689a444b1db1df3ccff2cc3d.tar.gz
CMake-1588a577d16cfb1a689a444b1db1df3ccff2cc3d.tar.bz2
Add policy CMP0069 to enforce INTERPROCEDURAL_OPTIMIZATION
Previously the `INTERPROCEDURAL_OPTIMIZATION` target property was honored only for the Intel compiler on Linux and otherwise ignored. In order to add support for more compilers incrementally without changing behavior in the future, add a new policy whose NEW behavior enforces the `INTERPROCEDURAL_OPTIMIZATION` property. Add flags for supported compilers and otherwise produce an error.
Diffstat (limited to 'Modules/CheckIPOSupported.cmake')
-rw-r--r--Modules/CheckIPOSupported.cmake15
1 files changed, 14 insertions, 1 deletions
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index 55c8901..31c1bd3 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -28,6 +28,9 @@ property.
Specify languages whose compilers to check.
Languages ``C`` and ``CXX`` are supported.
+It makes no sense to use this module when :policy:`CMP0069` is set to ``OLD`` so
+module will return error in this case. See policy :policy:`CMP0069` for details.
+
Examples
^^^^^^^^
@@ -125,7 +128,17 @@ macro(_ipo_run_language_check language)
endmacro()
function(check_ipo_supported)
- # TODO: IPO policy
+ cmake_policy(GET CMP0069 x)
+
+ string(COMPARE EQUAL "${x}" "" not_set)
+ if(not_set)
+ message(FATAL_ERROR "Policy CMP0069 is not set")
+ endif()
+
+ string(COMPARE EQUAL "${x}" "OLD" is_old)
+ if(is_old)
+ message(FATAL_ERROR "Policy CMP0069 set to OLD")
+ endif()
set(optional)
set(one RESULT OUTPUT)