summaryrefslogtreecommitdiffstats
path: root/Modules/CheckCCompilerFlag.cmake
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-07-27 19:01:50 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-07-27 19:01:50 (GMT)
commitb7f3f7cdb62fcadba806aca8168c88a9a637eda6 (patch)
treedc00d0b8edd1b18488127aba56bcbe7a82486ac2 /Modules/CheckCCompilerFlag.cmake
parent49a00ec2def5882aa056638c3ae0b3088157de93 (diff)
downloadCMake-b7f3f7cdb62fcadba806aca8168c88a9a637eda6.zip
CMake-b7f3f7cdb62fcadba806aca8168c88a9a637eda6.tar.gz
CMake-b7f3f7cdb62fcadba806aca8168c88a9a637eda6.tar.bz2
Add fail regex to detect supported warning flags correctly.
On Apple's gcc, the compiler emits a warning such as "warning: command line option "-Wno-deprecated" is valid for C++/ObjC++ but not for C" when it is passed that flag on its command line. When testing for that flag with a plain C file, we should report that the flag is unsupported for C files. The new FAIL_REGEX option added here produces this behavior.
Diffstat (limited to 'Modules/CheckCCompilerFlag.cmake')
-rw-r--r--Modules/CheckCCompilerFlag.cmake3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index a03b64d..a390b38 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -27,6 +27,8 @@ MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT}
# Some compilers do not fail with a bad flag
+ FAIL_REGEX "warning: command line option .* is valid for .* but not for C"
+ # Apple gcc
FAIL_REGEX "unrecognized .*option" # GNU
FAIL_REGEX "ignoring unknown option" # MSVC
FAIL_REGEX "warning D9002" # MSVC, any lang
@@ -36,4 +38,3 @@ MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
)
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
ENDMACRO (CHECK_C_COMPILER_FLAG)
-