View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008776CMakeCMakepublic2009-03-21 19:572016-06-10 14:30
ReporterDaniel Nelson 
Assigned ToBill Hoffman 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0008776: Source files should have a modern COMPILE_OPTIONS property.
Description[Original title: Using set_property() on COMPILE_FLAGS with multiple options results in bad command in Makefiles]

If you have a CMakeLists.txt with a line like this:
set_property(SOURCE main.cpp PROPERTY COMPILE_FLAGS -Werror -Wall)

You will get a build command in build.make:
/usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -Werror;-Wall -o CMakeFiles/bug.dir/main.cpp.o -c /home/torham/src/cmake/prop_bug/main.cpp

The two options are added with a ; instead of a space, and sh will try to execute the second command '-Wall'

You can avoid this by doing some escaping in the CMakeLists.txt yourself, but it would be nicer if this wasn't necessary:
set_property(SOURCE main.cpp PROPERTY COMPILE_FLAGS "\"-Werror\" \"-Wall\"")

This might effect similar commands too.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0015750)
Bill Hoffman (manager)
2009-03-22 21:54

Or you could do this:

set_property(SOURCE main.cpp PROPERTY COMPILE_FLAGS "-Werror -Wall")
(0015795)
Daniel Nelson (reporter)
2009-03-24 18:28

Yeah that works. I also noticed you have the same problem if you try to do something like this:

set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_FLAGS -Wall)
# ... do other stuff ...
set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_FLAGS -Werror)
(0034324)
Stephen Kelly (developer)
2013-11-02 10:22

A COMPILE_OPTIONS property should be added so that you don't need APPEND_STRING in that case.
(0041523)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

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
2009-03-21 19:57 Daniel Nelson New Issue
2009-03-22 21:54 Bill Hoffman Note Added: 0015750
2009-03-22 21:54 Bill Hoffman Status new => assigned
2009-03-22 21:54 Bill Hoffman Assigned To => Bill Hoffman
2009-03-24 18:28 Daniel Nelson Note Added: 0015795
2013-11-02 10:22 Stephen Kelly Note Added: 0034324
2013-11-02 10:22 Stephen Kelly Summary Using set_property() on COMPILE_FLAGS with multiple options results in bad command in Makefiles => Source files should have a modern COMPILE_OPTIONS property.
2013-11-02 10:22 Stephen Kelly Description Updated
2016-06-10 14:27 Kitware Robot Note Added: 0041523
2016-06-10 14:27 Kitware Robot Status assigned => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team