My project consists of a lot of "module" style targets (static libraries,
more or less), but only a few top-level targets that a user would actually
want to build. The "all" target is empty, that is, every target has
"EXCLUDE_FROM_ALL" set. The user will, at compile time, decide to build
whichever target they need. A single target may depend on a couple of
others, so the end result of a single target being built might be eg. an
exe file plus a dll plus a couple of other things.

But I also want to provide installation capabilities, so users don't have
to hunt down exes and libs scattered throughout CMake's build tree. I might
want to create installers using CPack at some point too.

How do I do this if all of my targets are EXCLUDE_FROM_ALL? According to
the documentation, even if I use the OPTIONAL flag in install(), the
behaviour is undefined. Better not do that.

The only other option I see is to create custom commands (POST_BUILD style)
for every target that copies it to some designated output directory. But
then I can't take advantage of CMake's other installation capabilities, and
I think that would be invisible to CPack.

Is there some other way?

I'm using CMake 3.12 on Windows 10/Ubuntu 18.04, if that's relevant.

Cheers,
Jason
-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to