diff options
author | Brad King <brad.king@kitware.com> | 2017-06-14 14:12:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-06-14 14:36:57 (GMT) |
commit | ba247ccabab05c0aad4fe7f56dd020bfa8ff4583 (patch) | |
tree | 259898e83b41d70b454287d01e88923ecb1bbd4e /Modules/CheckIPOSupported.cmake | |
parent | d025faf436c86ee9cc033fbb324a9bc2c18757fa (diff) | |
download | CMake-ba247ccabab05c0aad4fe7f56dd020bfa8ff4583.zip CMake-ba247ccabab05c0aad4fe7f56dd020bfa8ff4583.tar.gz CMake-ba247ccabab05c0aad4fe7f56dd020bfa8ff4583.tar.bz2 |
IPO: Consider support for each language separately
We only define `INTERPROCEDURAL_OPTIMIZATION` behavior for C, CXX, and
Fortran languages. Do not try to enable support for other languages.
Furthermore, each language builds with a different compiler, so check
for support by CMake and the compiler for each language independently.
Fixes: #16944
Diffstat (limited to 'Modules/CheckIPOSupported.cmake')
-rw-r--r-- | Modules/CheckIPOSupported.cmake | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake index 6bbde13..e04ab1c 100644 --- a/Modules/CheckIPOSupported.cmake +++ b/Modules/CheckIPOSupported.cmake @@ -207,15 +207,17 @@ function(check_ipo_supported) endif() endif() - if(NOT _CMAKE_IPO_SUPPORTED_BY_CMAKE) - _ipo_not_supported("CMake doesn't support IPO for current compiler") - return() - endif() + foreach(lang ${languages}) + if(NOT _CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE) + _ipo_not_supported("CMake doesn't support IPO for current ${lang} compiler") + return() + endif() - if(NOT _CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER) - _ipo_not_supported("Compiler doesn't support IPO") - return() - endif() + if(NOT _CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER) + _ipo_not_supported("${lang} compiler doesn't support IPO") + return() + endif() + endforeach() if(CMAKE_GENERATOR MATCHES "^Visual Studio ") _ipo_not_supported("CMake doesn't support IPO for current generator") |