[cmake-developers] [CMake 0012576]: CHECK_C_COMPILER_FLAG is inflexible for FAIL_REGEX

Mantis Bug Tracker mantis at public.kitware.com
Sat Nov 12 09:19:52 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12576 
====================================================================== 
Reported By:                Hans Johnson
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12576
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-11-12 09:19 EST
Last Modified:              2011-11-12 09:19 EST
====================================================================== 
Summary:                    CHECK_C_COMPILER_FLAG is inflexible for FAIL_REGEX
Description: 
The end user that wants to use a new compiler has no way to add a new FAIL_REGEX
option to the 
CHECK_C_COMPILER_FLAG macro.

In ITK we created a custom ITK_CHECK_C_COMPILER_FLAG that adds only one line in
order to properly handle the intel compiler.

It would be very nice if this macro were refactored so that one could append new
FAIL_REGEX strings from end-user build environments without the need to copy and
alter this macro set.

Hans


Steps to Reproduce: 
	MACRO (ITK_CHECK_C_COMPILER_FLAG _FLAG _RESULT)
26	   SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
27	   SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
28	   CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT}
29	     # Some compilers do not fail with a bad flag
30	     FAIL_REGEX "warning: command line option .* is valid for .* but not for
C"
31	                                                            # Apple gcc
32	     FAIL_REGEX "unrecognized .*option"                     # GNU
33	     FAIL_REGEX "unknown .*option"                          # Clang
34	     FAIL_REGEX "ignoring unknown option"                   # MSVC
35	     FAIL_REGEX "warning D9002"                             # MSVC, any lang
36	     FAIL_REGEX "[Uu]nknown option"                         # HP
37	     FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
38	     FAIL_REGEX "command option .* is not recognized"       # XL
39	     FAIL_REGEX "warning http://public.kitware.com/Bug/view.php?id=10156:
ignoring option"       # INTEL compilers
40	     )
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-11-12 09:19 Hans Johnson   New Issue                                    
======================================================================




More information about the cmake-developers mailing list