[CMake] EXCLUDE_FROM_ALL not working?

Petr Kmoch petr.kmoch at gmail.com
Mon Feb 11 03:09:09 EST 2013


Hi all.

I believe the reason is that EXCLUDE_FROM_ALL excludes the target from the
default 'all' target (Makefiles), which is represented by the custom target
ALL_BUILD in Visual Studio. EXCLUDE_FROM_DEFAULT_BUILD instead works with
Visual Studio's "Build Solution" command, which has no direct equivalent in
the Makefile world.

This means projects using VS solutions as "just a way to do command-line
builds on Windows" probably use ALL_BUILD and are fine with setting just
EXCLUDE_FROM_ALL. Projects which expect their developers to actively work
in the VS IDE (and thus use "Build Solution" and the like) have to set both
EXCLUDE_FROM_* properties.

Petr

On Fri, Feb 8, 2013 at 11:14 PM, Robert Dailey <rcdailey.lists at gmail.com>wrote:

> The library itself depends on other ones I generated, but it isn't a
> dependency itself.
>
> I did some more research and setting EXCLUDE_FROM_DEFAULT_BUILD
> worked... I find it strange that there are 2 properties that
> essentially should do the same thing, but cause different behavior
> depending on the selected generator:
>
>
> function( _exclude_target target_name )
>     set_target_properties(
>         ${target_name} PROPERTIES
>         EXCLUDE_FROM_DEFAULT_BUILD TRUE
>         EXCLUDE_FROM_ALL TRUE
>     )
> endfunction()
>
> On Fri, Feb 8, 2013 at 4:01 PM, David Cole <dlrdave at aol.com> wrote:
> > Does another library that you add later depend on that one? Or an
> > executable?
> >
> > If so, then the library will be added because it's required by
> dependencies,
> > despite your request to exclude it from all.
> >
> >
> >
> > -----Original Message-----
> > From: Robert Dailey <rcdailey.lists at gmail.com>
> > To: CMake <cmake at cmake.org>
> > Sent: Fri, Feb 8, 2013 4:59 pm
> > Subject: [CMake] EXCLUDE_FROM_ALL not working?
> >
> > I am calling add_library like so:
> >
> > set( project_name mylib )
> > set( files main.cpp main.h )
> > set( exclude_flag EXCLUDE_FROM_ALL )
> > add_library( "${project_name}" SHARED ${exclude_flag} ${files} )
> >
> > When I generate for Visual Studio 2008, I check the build
> > configuration and the mylib project is still setup to build when I
> > invoke Build Solution. Why isn't this flag working?
> > --
> >
> > 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
> --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130211/b37da52b/attachment.htm>


More information about the CMake mailing list