[cmake-developers] [CMake 0016038]: CHECK_COMPILER_FLAG_COMMON_PATTERNS doesn't match clang-cl's unknown argument warning

Mantis Bug Tracker mantis at public.kitware.com
Wed Mar 30 14:51:00 EDT 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=16038 
====================================================================== 
Reported By:                Reid Kleckner
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   16038
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2016-03-30 14:51 EDT
Last Modified:              2016-03-30 14:51 EDT
====================================================================== 
Summary:                    CHECK_COMPILER_FLAG_COMMON_PATTERNS doesn't match
clang-cl's unknown argument warning
Description: 
These are the patterns that cmake appears to be looking for to spot unsupported
options:
     FAIL_REGEX "unknown .*option"                          # Clang
     FAIL_REGEX "optimization flag .* not supported"        # Clang

But we actually have two other diagnostics, one of which needs to be matched:
def err_drv_unknown_argument : Error<"unknown argument: '%0'">;
def warn_drv_unknown_argument_clang_cl : Warning<
  "unknown argument ignored in clang-cl: '%0'">,
  InGroup<UnknownArgument>;

The first is an error diagnostic, so you don't need to match it. We added the
second because MSVC ignores unknown flags, and clang-cl needs to do the same. We
chose the text for consistency with the error diagnostic.

Steps to Reproduce: 
Have this in a cmake project:
check_cxx_compiler_flag(-not-a-real-flag IS_REAL_FLAG)

Configure the project with clang-cl as the compiler.

Observe that IS_REAL_FLAG is ON.

Additional Information: 
This came up while I was trying to build asan with clang-cl.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-03-30 14:51 Reid Kleckner  New Issue                                    
======================================================================



More information about the cmake-developers mailing list