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.

Is there a way around doing all this rebuilding?
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to