I have this simple CMakeLists.txt:

add_custom_target(deptest ALL DEPENDS files.out)
add_custom_command(OUTPUT foo.x COMMAND touch foo.x DEPENDS foo.cpp)
add_custom_command(OUTPUT bar.x COMMAND false DEPENDS bar.cpp)
add_custom_command(OUTPUT files.out COMMAND touch files.out DEPENDS foo.x
bar.x)

Notice that bar.x always fails building intentionally, to demonstrate this
issue:

When I generate Visual Studio 10 solution & project files from this and
build it, it keeps regenerating foo.x every time i choose "Build Solution",
even though it is generated perfectly the first time. Only if ALL the
dependencies of files.out are successfully generated, will VS stop building
each and every one.

This is a small problem for this example, but becomes a major nuisance in a
project with hundreds of custom commands generating intermediate files
based on .cpp source files. If just one of them fails, they are all rebuilt.

I don't know if this is the fault of CMake or Visual Studio, but perhaps
someone else have some insight. I cannot see anything wrong with the
dependency settings for the generated .vcxproj files.

With the "MinGW Makefiles" generator, I don't have the same problem, and
foo.x is only built once.
--

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