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

Dirk Steenpass dirk.steenpass at gmail.com
Wed Jun 11 18:55:22 EDT 2014


Hello,

I am indeed trying to figure out whether I have a case "where a non-default
target is
not being made default despite a dependency on it", but just could not put
it that clearly. I attach a zipfile to demonstrate my problem. And, to add
to my confusion I succeeded in making the respective target default and
have it not added nonetheless...

I used VS2013 and the appropriate generator.

After generation the example contains three solutions:
    foo\foo.sln
    foo\alib\alib.sln
    foo\aapp\aapp.sln

The troublemaker is the custom target 'run_agen'.
Open all three solutions and check the configuration manager:
    foo.sln  : run_agen is marked for building
    alib.sln : run_agen is marked for building
    aapp.sln: run_agen is *not* marked for building

I feel that run_agen should be marked for building in aapp.sln.

Thanks,
Dirk



On Wed, Jun 11, 2014 at 8:16 PM, Brad King <brad.king at kitware.com> wrote:

> 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
>
>


-- 
Dirk Steenpass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140612/c1425cf1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.zip
Type: application/zip
Size: 2525 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140612/c1425cf1/attachment.zip>


More information about the CMake mailing list