I have this simple CMakeLists.txt:<br><br>add_custom_target(deptest ALL DEPENDS files.out)<br>add_custom_command(OUTPUT foo.x COMMAND touch foo.x DEPENDS foo.cpp)<br>add_custom_command(OUTPUT bar.x COMMAND false DEPENDS bar.cpp)<br>
add_custom_command(OUTPUT files.out COMMAND touch files.out DEPENDS foo.x bar.x)<br><br>Notice that bar.x always fails building intentionally, to demonstrate this issue:<br><br>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.<br>
<br>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.<br>
<br>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.<br><br>With the "MinGW Makefiles" generator, I don't have the same problem, and foo.x is only built once.<br>