MantisBT - CMake
View Issue Details
0015285CMakeCMakepublic2014-12-04 14:412015-05-04 09:05
Braden McDaniel 
 
normalminoralways
closedduplicate 
CMake 3.0.2 
 
0015285: Cannot escape "#" in add_compile_options
I've found no way to escape the "#" character when it needs to occur in an compiler option in the add_compile_options command. When adding such an option to, for instance, the CMAKE_CXX_FLAGS variable, it can be escaped with a backslash ("\"); but this does not appear to work when using add_compile_options.
For example:

add_compile_options(-Wno-\#pragma-messages)

In the generated output (using the Unix Makefile generator), this string is added to the command line:

 "-Wno-
This is workable; but does not use add_compile_options:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-\\#pragma-messages")
No tags attached.
duplicate of 0015070closed Brad King CMake doesn't escape # properly in add_compile_options with Makefile generator 
related to 0014547closed Kitware Robot Unix Makefile generator won't escape '#' 
related to 0013562closed Kitware Robot Incorrect Makefiles generated for paths containing '#' 
related to 0014745closed  Can't build a project if build directory contains '#' character, i.e. "issue#6" 
Issue History
2014-12-04 14:41Braden McDanielNew Issue
2014-12-04 14:44Brad KingRelationship addedrelated to 0014547
2014-12-04 14:44Brad KingRelationship addedrelated to 0013562
2014-12-04 14:46Brad KingRelationship addedrelated to 0014745
2014-12-04 14:46Brad KingRelationship addedrelated to 0015070
2014-12-04 14:47Brad KingRelationship replacedduplicate of 0015070
2014-12-04 14:48Brad KingNote Added: 0037387
2014-12-04 14:48Brad KingStatusnew => resolved
2014-12-04 14:48Brad KingResolutionopen => duplicate
2015-05-04 09:05Robert MaynardNote Added: 0038690
2015-05-04 09:05Robert MaynardStatusresolved => closed

Notes
(0037387)
Brad King   
2014-12-04 14:48   
Resolving as duplicate of 0015070.
(0038690)
Robert Maynard   
2015-05-04 09:05   
Closing resolved issues that have not been updated in more than 4 months.