[CMake] Why is target is not added to default built in Visual Studio?

Brad King brad.king at kitware.com
Wed Jun 11 14:16:13 EDT 2014


On 06/11/2014 11:57 AM, Dirk Steenpass wrote:
> I could not make myself any clearer I re-post a question by
> William Deurwaarder on Apr 11, 2014.
[snip]
> root/A -> in this CMakeLists.txt a custom-target is defined 
> root/B -> in this CMakeLists.txt a static-library is defined which depends on A
> root/C -> in this CMakeLists.txt the executable is defined which depends on B
> root -> in this CMakeLists.txt all three sub-directories are added. 

Please provide a tarball or zipfile with a minimal source tree
demonstrating the problem.

> what is the reason to exclude A from the default-build

If add_custom_target is called without the ALL option then it
will not normally be part of the default build.  It could be
some utility operation that should not normally run but can
be manually triggered.  As explained in William's original
message, and here:

 http://www.cmake.org/Bug/view.php?id=14929#c35918

it is necessary to bring such targets into the default build if
they are depended upon by other targets that are in the
default build.  (It would be much simpler if VS were to honor
dependencies as one might expect instead of skipping things.)

IIUC you are reporting a case where a non-default target is
not being made default despite a dependency on it.  A specific
example tarball will help clarify that.

Thanks,
-Brad



More information about the CMake mailing list