[CMake] EXCLUDE_FROM_DEFAULT_BUILD: a solution that works for both interactive and unattended builds

Alessio masariello+cmake.org at gmail.com
Tue May 12 07:28:27 EDT 2015


Hi All

(similar questions have been asked before, but none has quite hit the mark)

Is there any way to force MSVC to build custom targets marked with
EXCLUDE_FROM_DEFAULT_BUILD?

Using

      cmake --build . --target SOME_EXCLUDED_TARGET --config Release

will produce the well known message

     Project not selected to build for this solution configuration

I could find the following two ways to get the targets to build, but they
all have drawbacks:

   1. Use a BATCH_BUILD variable that will disable the setting of
EXCLUDE_FROM_DEFAULT_BUILD
   on the targets.
   2. Define a set of build configurations on which
EXCLUDE_FROM_DEFAULT_BUILD_<config>
   is not set (e.g. Release_ALL is identical to Release, except it has no
   build exclusions)

Option 1 has the drawback of producing solutions that do not work well for
interactive development

Option 2 is rather cumbersome and would require the users to build separate
sets of binaries. I could not quite figure out a way to make the
Release_ALL packaging commands reference the Release target binaries.

Has anyone figured out a way to get the full monty, i.e. a way to generate
an MSVC solution that works well for both interactive and command line
builds?

Thank you so much for any feedback you can provide on this
-alessio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150512/04683e07/attachment.html>


More information about the CMake mailing list