View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016032CMakeCMakepublic2016-03-22 15:062016-06-10 14:21
ReporterBraden McDaniel 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformAppleOSMac OS XOS Version10.11.3
Product VersionCMake 3.5 
Target VersionFixed in Version 
Summary0016032: CMake doesn't escape # properly in add_compile_options with Makefile generator
DescriptionThis appears to have regressed in 3.5. If I do:

  add_compile_options(-Wno-#pragma-messages)

I get

  -Wno-

...on the command line.
Tagsmakefile
Attached Files

 Relationships

  Notes
(0040752)
Brad King (manager)
2016-03-22 15:24

$ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 3.4)
project(Issue16032 C)
add_compile_options("-Wno-#pragma-messages")
add_executable(foo foo.c)

$ cmake --version
cmake version 3.5.0

$ cmake ..
-- The C compiler identification is GNU 5.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /.../b
$ make VERBOSE=1 | grep pragma
/usr/bin/cc "-Wno-#pragma-messages" -o CMakeFiles/foo.dir/foo.c.o -c "/.../foo.c"
(0040753)
Brad King (manager)
2016-03-22 15:25

> add_compile_options(-Wno-#pragma-messages)

The "#" character on the line shown in the description will be parsed as the beginning of a line comment since it is not in a quoted argument. CMake reports an error on that line for me so please post a more complete example.
(0040756)
Braden McDaniel (reporter)
2016-03-23 14:20

Alright... Apparently I misunderstood some previous comments regarding how this is intended to operate.

As to why I didn't observe an error: in my actual code, the closing parenthesis was on a separate line.

This can be closed.
(0041214)
Kitware Robot (administrator)
2016-06-10 14:21

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-03-22 15:06 Braden McDaniel New Issue
2016-03-22 15:08 Braden McDaniel Tag Attached: makefile
2016-03-22 15:24 Brad King Note Added: 0040752
2016-03-22 15:25 Brad King Note Added: 0040753
2016-03-23 14:20 Braden McDaniel Note Added: 0040756
2016-03-23 14:21 Brad King Status new => resolved
2016-03-23 14:21 Brad King Resolution open => no change required
2016-06-10 14:21 Kitware Robot Note Added: 0041214
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team