[CMake] dependency checking
Bill Hoffman
bill.hoffman at kitware.com
Thu Aug 9 13:47:58 EDT 2007
Juan Sanchez wrote:
> 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"
> )
>
OK, this is a bug... Please create a bug report www.cmake.org/Bug.
Include your example if you could. The problem is a comment in the
flags.make file for each .o file with custom flags. I see no reason to
put that comment in the file.
So, to get around the problem you have two choices:
1. use CMAKE_CXX_FLAGS instead.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
That will change all targets in that directory and below.
2. set CMAKE_SKIP_RULE_DEPENDENCY to true.
I would recommend 1, as 2 will cause trouble if you really do change
flags.
-Bill
More information about the CMake
mailing list