[cmake-developers] [CMake 0015070]: CMake doesn't escape # properly in add_compile_options with Makefile generator

Mantis Bug Tracker mantis at public.kitware.com
Thu Aug 7 15:02:38 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15070 
====================================================================== 
Reported By:                Vitali
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15070
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-08-07 15:02 EDT
Last Modified:              2014-08-07 15:02 EDT
====================================================================== 
Summary:                    CMake doesn't escape # properly in
add_compile_options with Makefile generator
Description: 
add_compile_options appears to generate the wrong escape sequence for:
add_compile_options("-Wno-error=#warnings")

when used in conjuction with the Makefile generator

Steps to Reproduce: 
add_compile_options("-Wno-error=#warnings")

Use makefile generator

Look at flags.make:
CXX_FLAGS = ... "-Wno-error=#warnings" ...
It should be:
CXX_FLAGS = "-Wno-error=\#warnings"
due to shell-expansion (otherwise # gets treated as a comment).

Additional Information: 
No amount of escaping in CMake fixes this.
It looks like CMake is already aware of \ escaping for the Makefile generator
but not for #:

add_compile_options("-Wno-error=\#warnings")
CXX_FLAGS = ... "-Wno-error=#warnings" ...

add_compile_options("-Wno-error=\\#warnings")
CXX_FLAGS = ... "-Wno-error=\\#warnings" ...

add_compile_options("-Wno-error=\\\#warnings")
CXX_FLAGS = ... "-Wno-error=\\#warnings" ...
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-08-07 15:02 Vitali         New Issue                                    
======================================================================



More information about the cmake-developers mailing list