View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005473CMakeCMakepublic2007-08-09 14:052016-06-10 14:30
Reporterufnoise 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005473: rebuild always triggered when using SET_SOURCE_FILES_PROPERTIES
DescriptionWhen I use SET_SOURCE_FILES_PROPERTIES on a list of files, adding or removing a file triggers a rebuild of all of the files in the library. Only the file being added would need to be recompiled.

PROJECT(main)
SET (SRCS a.cc b.cc c.cc d.cc e.cc f.cc g.cc)
ADD_EXECUTABLE(a ${SRCS})
ADD_LIBRARY(b ${SRCS})
SET_SOURCE_FILES_PROPERTIES (
  ${SRCS}
  COMPILE_FLAGS "-Wall"
)
TagsNo tags attached.
Attached Files

 Relationships
has duplicate 0014152closedBrad King Comment change in flags.make triggers unnecessary rebuilds 

  Notes
(0009968)
Brad King (manager)
2007-12-17 18:02

Ken, this is because flags.make gets lines like this:

# Custom flags: CMakeFiles/b.dir/a.o_FLAGS = -Wall
# Custom flags: CMakeFiles/b.dir/b.o_FLAGS = -Wall

Adding or removing a line causes rebuilds just as much as changing the flags. My original design had a separate rule file per object so that this would not happen. Of course that had the problem of taking forever to generate so many build files on Windows filesystems.
(0009969)
Brad King (manager)
2007-12-17 18:05

ufnoise, you can work around this by not setting these flags directly on the source files. The COMPILE_FLAGS property is really meant for when one file has something special as compared to the others.

You may use SET_TARGET_PROPERTIES to add the flags to the target's COMPILE_FLAGS property, or add the flags to the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS variables directly.
(0030553)
Brad King (manager)
2012-08-13 10:44

Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0033083)
Craig Scott (reporter)
2013-05-17 08:25

We are also being bitten by this problem. In our case, we have the software package version passed through as a define to just those few source files that need it. Because of this bug, however, whenever we change the software version, the whole target gets rebuilt rather than just those few files that should be affected.
(0033086)
Brad King (manager)
2013-05-17 09:00

Re 0005473:0033083: This is not a bug, just the lack of an optimization. We once experimented with per-object rule files for dependencies and it was *very* slow on filesystems that do not deal well with lots of small files. Therefore we use one flags.make file for a whole target.

The comment is used in flags.make specifically in order to *cause* this rebuild so that changing per-source flags will result in a correct rebuild.

I suggest one of the following workarounds:

* Use an OBJECT library to hold the sources with special flags so that only those rebuild when the per-source flags change.

* Use the Ninja generator
(0041379)
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
2007-08-09 14:05 ufnoise New Issue
2007-12-17 17:54 Bill Hoffman Status new => assigned
2007-12-17 17:54 Bill Hoffman Assigned To => Brad King
2007-12-17 18:00 Brad King Assigned To Brad King => Ken Martin
2007-12-17 18:02 Brad King Note Added: 0009968
2007-12-17 18:05 Brad King Note Added: 0009969
2010-12-14 11:32 David Cole Assigned To Ken Martin => Brad King
2011-01-26 11:24 David Cole Category => CMake
2012-08-13 10:44 Brad King Status assigned => backlog
2012-08-13 10:44 Brad King Note Added: 0030553
2013-05-17 08:15 Brad King Assigned To Brad King =>
2013-05-17 08:16 Brad King Relationship added has duplicate 0014152
2013-05-17 08:25 Craig Scott Note Added: 0033083
2013-05-17 09:00 Brad King Note Added: 0033086
2016-06-10 14:27 Kitware Robot Note Added: 0041379
2016-06-10 14:27 Kitware Robot Status backlog => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:27 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team