MantisBT - CMake
View Issue Details
0008787CMakeCMakepublic2009-03-24 18:402013-10-21 11:21
Daniel Nelson 
 
normalminoralways
closedwon't fix 
CMake-2-6 
 
0008787: set_property on sources causing extra files to be rebuilt
I am using set_property to add extra compile flags to source files that are
built using a precompiled header, but whenever a source file is added or
removed it causes every file in the executable to be rebuilt. I have come up
with a CMakeList that shows the issue.

#####
cmake_minimum_required(VERSION 2.6)
project(prop_test)
set(sources foo.cpp bar.cpp main.cpp)
add_executable(prop_test ${sources})
set_property(SOURCE foo.cpp main.cpp APPEND PROPERTY COMPILE_FLAGS -Wall)
#####

If you compile the project using a Makefile generator, then remove foo.cpp from
the sources variable and recompile, it will also recompile main.cpp and
bar.cpp even though no compile flags have changed. If you then put foo.cpp
back and build it will again rebuild main.cpp and bar.cpp. It seems that you
will need to rebuild every source file that is used in the executable, even
though nothing has changed.

The problem appears to be that all files depend on flags.make so they will be rebuilt if a flag changes. But since they all share the same flags.make, they will always be rebuilt as a group. Perhaps we could write a separate flags.make file for every object file that has compile/define flags set?
No tags attached.
duplicate of 0008642closed Bill Hoffman recompile of all files when adding one 
Issue History
2009-03-24 18:40Daniel NelsonNew Issue
2009-03-24 19:08Daniel NelsonNote Added: 0015796
2009-03-27 12:25Bill HoffmanRelationship addedduplicate of 0008642
2009-03-27 12:26Bill HoffmanStatusnew => closed
2009-03-27 12:26Bill HoffmanResolutionopen => won't fix
2013-10-21 11:21Brad KingRelationship addedrelated to 0014493
2013-10-21 11:22Brad KingRelationship deletedrelated to 0014493

Notes
(0015796)
Daniel Nelson   
2009-03-24 19:08   
This is a duplicate of 8642, sorry.