summaryrefslogtreecommitdiffstats
path: root/Modules/CheckCXXCompilerFlag.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-09-18 13:49:44 (GMT)
committerBrad King <brad.king@kitware.com>2009-09-18 13:49:44 (GMT)
commit83957d9e0defcff8ae497078a47f77f183674f16 (patch)
tree172f0aa949f2fb8da272393fa1f0c39ae2f54758 /Modules/CheckCXXCompilerFlag.cmake
parentb872d09ea294f594669fc2b07f18040776a55bfb (diff)
downloadCMake-83957d9e0defcff8ae497078a47f77f183674f16.zip
CMake-83957d9e0defcff8ae497078a47f77f183674f16.tar.gz
CMake-83957d9e0defcff8ae497078a47f77f183674f16.tar.bz2
Fix CHECK_(C|CXX)_COMPILER_FLAG for XL and SunPro
These compilers warn and return 0 for unrecognized flags. We fix the compiler flag check macros by looking for a warning in the output. We also update the regex for GNU on older Macs. See issue #9516.
Diffstat (limited to 'Modules/CheckCXXCompilerFlag.cmake')
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index 018eacd..8f1b789 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -19,9 +19,11 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
# Some compilers do not fail with a bad flag
- FAIL_REGEX "unrecognized option" # GNU
+ FAIL_REGEX "unrecognized .*option" # GNU
FAIL_REGEX "ignoring unknown option" # MSVC
FAIL_REGEX "[Uu]nknown option" # HP
+ FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
+ FAIL_REGEX "command option .* is not recognized" # XL
)
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
ENDMACRO (CHECK_CXX_COMPILER_FLAG)