[cmake-developers] [CMake 0014923]: check_cxx_compiler_flag fails when variable name contains "++"

Mantis Bug Tracker mantis at public.kitware.com
Wed May 21 05:24:02 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14923 
====================================================================== 
Reported By:                skvadrik
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14923
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-05-21 05:24 EDT
Last Modified:              2014-05-21 05:24 EDT
====================================================================== 
Summary:                    check_cxx_compiler_flag fails when variable name
contains "++"
Description: 
The following call:

check_cxx_compiler_flag(-Weffc++ CXX_FLAG_-Weffc++)

Leads to the following error:

RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at /usr/share/cmake/Modules/CheckCXXSourceCompiles.cmake:30 (if):
  if given arguments:

    "LJS_CXX_FLAG_-Weffc++" "MATCHES" "^LJS_CXX_FLAG_-Weffc++\$"

  Regular expression "^LJS_CXX_FLAG_-Weffc++$" cannot compile


Steps to Reproduce: 
check_cxx_compiler_flag(-Weffc++ CXX_FLAG_-Weffc++)

Additional Information: 
check_cxx_compiler_flag calls check_cxx_source_compiles. The latter tries to
interpret variable name as a regexp:

if("${VAR}" MATCHES "^${VAR}$")

which leads to an error for a variable name "CXX_FALG_-Weffc++" (and many other
variable names, which are generally accepted by cmake)
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-05-21 05:24 skvadrik       New Issue                                    
======================================================================



More information about the cmake-developers mailing list