[CMake] dependency checking

Juan Sanchez Juan.Sanchez at amd.com
Thu Aug 9 13:32:36 EDT 2007


Hi Bill,

I ran a test and figured out what is triggering the problem.  The
problem is that I have SET_SOURCE_FILES_PROPERTIES which operates on
${SRCS}.  By adding to ${SRCS} it triggers the rebuild of all of the
files listed, and not just of the one I added.

If I comment out SET_SOURCE_FILES_PROPERTIES, I can add or remove files
from ${SRCS} without retriggering costly rebuilds.

Is there any way to change this behavior?  Unfortunately the project I
am porting has source files for multiple libraries in the same
directory.  I'd hate to have to list each file individually.

Regards,

Juan

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"
)


Bill Hoffman wrote:
> Juan Sanchez wrote:
>> I just added a source file to the list of sources in my library and now
>> it is recompiling every source file in that library.  I don't feel
>> rebuilding the other source files is necessary and I'd like a way to
>> tell cmake to trust me and that any object files I have are still good.
>>   
> Either that is a bug, or a compiler flag has changed.   CMake should 
> only rebuild object files if
> the source (including headers) for that file changes, or if the flags 
> used to compile that object
> file changes.
> 
> make -d can be used to figure out why make is rebuilding the object files.
> 
> 
> -Bill
> 
> 
> 


-- 
Juan Sanchez
Juan.Sanchez at amd.com
800-538-8450 Ext. 54395
512-602-4395




More information about the CMake mailing list