[CMake] Custom targets & dependencies causing unintended builds

Robert Dailey rcdailey.lists at gmail.com
Sat Jun 8 17:57:16 EDT 2013


I have two custom targets named A and B. These are not POST_BUILD
targets, these are targets set to depend on files generated by custom
commands. Neither custom target has the "ALL" option specified.

I have called add_dependencies( A B ) to make A depend on B.

When I Build Solution in Visual Studio, A does not build but B does
build. I think because B is a dependency of A, even though A itself
does not build, the dependency forces B to build. If I remove the
add_dependencies() call, then neither A or B builds (desired
behavior).

If I run a build on ALL_BUILD, then regardless of dependencies set,
neither A or B build (desired behavior).

This seems like a defect to me. When I go to Configuration Manager
(Right click solution -> Configuration Manager), I see that B is has
the check box under "Build" checked. This is supposed to be unchecked.
Basically when I make B a dependency of A, and B is a custom target,
it should exclude B from the build unless 1) A has a dependency or 2)
B has been created with the ALL option.

Comments?


More information about the CMake mailing list