Hello all,

I like "EXCLUDE_FROM_ALL", because with the Make-generator I can define
library-targets that will not be built with "make all" *unless* another
target depends on it.

This way, I can define libraries that will only be built if another
target depends on it.

Maybe that's not exactly the idea of EXCLUDE_FROM_ALL, but it is
convenient this way.


However, I don't see how exactly the same can be achieved with
Visual Studio.

Yes, I could tell developers to build the "ALL_BUILD" project instead
of hitting F7 (to build the solution) but that's not convenient.


Why is this a problem for us?

Because a library that no one depends on may actually not even build
under Windows and we don't want to clutter our CMakeLists with

if(WIN32)
   add_subdirectory(...)
endif()
.

Build times is another thing.


This issue has already been filed:

https://gitlab.kitware.com/cmake/cmake/issues/12379

and discussed in these threads:

http://public.kitware.com/pipermail/cmake/2011-August/045662.html
http://public.kitware.com/pipermail/cmake/2013-February/053528.html


I can think of two solutions, the latter being the cleaner IMO:

1. A property on a library-target that inhibits generation of the
   respective Visual Studio project if no other target depends on it.

2. Being able to mark targets as being "non-standalone" in the sense
   that they'll be ignored by the generator if no other targets depends
   on them.


For our case I found myself this workaround:
https://gist.github.com/sebknzl/ff6524420890fe6fdbdbc7d3264b103a


Thanks for your attention and greetings from Munich,
Sebastian Kienzl

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to