summaryrefslogtreecommitdiffstats
path: root/Help/generator
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-01-10 21:31:29 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-01-10 21:31:29 (GMT)
commite8032e202e23436cc4301b7ded23c3fdce1161b2 (patch)
tree9269877224bb3d6d70972887965d5d331fe11e3b /Help/generator
parent75e109a5b304ed502894f5e0ea791b327f6d1963 (diff)
downloadCMake-e8032e202e23436cc4301b7ded23c3fdce1161b2.zip
CMake-e8032e202e23436cc4301b7ded23c3fdce1161b2.tar.gz
CMake-e8032e202e23436cc4301b7ded23c3fdce1161b2.tar.bz2
Ninja Multi-Config: Make cross-config building opt-in
Many users will want to use the Ninja Multi-Config generator like a traditional Visual Studio-style multi-config generator, which doesn't mix configurations - custom commands are built using target executables of the same configuration the command is for. We do not want to force these people to generate an N*N build matrix when they only need N*1, especially if they have lots of targets. Add a new variable, CMAKE_NINJA_CROSS_CONFIG_ENABLE, to opt-in to the cross-config build matrix.
Diffstat (limited to 'Help/generator')
-rw-r--r--Help/generator/Ninja Multi-Config.rst13
1 files changed, 10 insertions, 3 deletions
diff --git a/Help/generator/Ninja Multi-Config.rst b/Help/generator/Ninja Multi-Config.rst
index 71cc392..92ca760 100644
--- a/Help/generator/Ninja Multi-Config.rst
+++ b/Help/generator/Ninja Multi-Config.rst
@@ -19,9 +19,10 @@ the desired ``build-<Config>.ninja`` file with ``ninja -f``. Running
``build-<Config>.ninja`` as the ``-f`` file and ``<target>`` as the build
target.
-Executables and libraries of any configuration can be built regardless of which
+If :variable:`CMAKE_NINJA_CROSS_CONFIG_ENABLE` is turned on, executables and
+libraries of any configuration can be built regardless of which
``build-<Config>.ninja`` file is used, simply by specifying
-``<target>:<Config>`` as the Ninja target. You can also specify
+``<target>:<OtherConfig>`` as the Ninja target. You can also specify
``<target>:all`` to build a target in all configurations. Each
``build-<Config>.ninja`` file will additionally have ``<target>`` targets which
are aliases for ``<target>:<Config>``. However, custom commands and custom
@@ -30,6 +31,11 @@ targets will always use the configuration specified in
Ninja for the same file to be output with different commands in the same build
graph.
+If :variable:`CMAKE_NINJA_CROSS_CONFIG_ENABLE` is not enabled, you can still
+build any target in ``build-<Config>.ninja`` by specifying
+``<target>:<Config>`` or ``<target>``, but not ``<target>:<OtherConfig>`` or
+``<target>:all``.
+
Consider the following example:
.. code-block:: cmake
@@ -54,7 +60,8 @@ This would build the ``Debug`` configuration of ``generator``, which would be
used to generate ``generated.c``, which would be used to build the ``Debug``
configuration of ``generated``.
-But if you run the following instead:
+But if :variable:`CMAKE_NINJA_CROSS_CONFIG_ENABLE` is enabled, and you run the
+following instead:
.. code-block:: shell