1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-23 00:48:55 +08:00

Ninja Multi-Config: Rename variable to be more consistent

Also make some tweaks to the documentation.
This commit is contained in:
Kyle Edwards
2020-01-16 10:34:43 -05:00
parent 1e728706de
commit 310b58e961
6 changed files with 26 additions and 22 deletions

View File

@@ -19,8 +19,8 @@ the desired ``build-<Config>.ninja`` file with ``ninja -f``. Running
``build-<Config>.ninja`` as the ``-f`` file and ``<target>`` as the build ``build-<Config>.ninja`` as the ``-f`` file and ``<target>`` as the build
target. target.
If :variable:`CMAKE_NINJA_CROSS_CONFIG_ENABLE` is turned on, executables and If :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is turned on, executables
libraries of any configuration can be built regardless of which and libraries of any configuration can be built regardless of which
``build-<Config>.ninja`` file is used, simply by specifying ``build-<Config>.ninja`` file is used, simply by specifying
``<target>:<OtherConfig>`` 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 ``<target>:all`` to build a target in all configurations. Each
@@ -31,8 +31,8 @@ targets will always use the configuration specified in
Ninja for the same file to be output with different commands in the same build Ninja for the same file to be output with different commands in the same build
graph. graph.
If :variable:`CMAKE_NINJA_CROSS_CONFIG_ENABLE` is not enabled, you can still If :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is not enabled, you can
build any target in ``build-<Config>.ninja`` by specifying still build any target in ``build-<Config>.ninja`` by specifying
``<target>:<Config>`` or ``<target>``, but not ``<target>:<OtherConfig>`` or ``<target>:<Config>`` or ``<target>``, but not ``<target>:<OtherConfig>`` or
``<target>:all``. ``<target>:all``.
@@ -60,8 +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`` used to generate ``generated.c``, which would be used to build the ``Debug``
configuration of ``generated``. configuration of ``generated``.
But if :variable:`CMAKE_NINJA_CROSS_CONFIG_ENABLE` is enabled, and you run the But if :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is enabled, and you
following instead: run the following instead:
.. code-block:: shell .. code-block:: shell

View File

@@ -215,7 +215,6 @@ Variables that Change Behavior
/variable/CMAKE_MESSAGE_INDENT /variable/CMAKE_MESSAGE_INDENT
/variable/CMAKE_MESSAGE_LOG_LEVEL /variable/CMAKE_MESSAGE_LOG_LEVEL
/variable/CMAKE_MODULE_PATH /variable/CMAKE_MODULE_PATH
/variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE
/variable/CMAKE_POLICY_DEFAULT_CMPNNNN /variable/CMAKE_POLICY_DEFAULT_CMPNNNN
/variable/CMAKE_POLICY_WARNING_CMPNNNN /variable/CMAKE_POLICY_WARNING_CMPNNNN
/variable/CMAKE_PREFIX_PATH /variable/CMAKE_PREFIX_PATH
@@ -423,7 +422,8 @@ Variables that Control the Build
/variable/CMAKE_MODULE_LINKER_FLAGS_INIT /variable/CMAKE_MODULE_LINKER_FLAGS_INIT
/variable/CMAKE_MSVCIDE_RUN_PATH /variable/CMAKE_MSVCIDE_RUN_PATH
/variable/CMAKE_MSVC_RUNTIME_LIBRARY /variable/CMAKE_MSVC_RUNTIME_LIBRARY
/variable/CMAKE_NINJA_CROSS_CONFIG_ENABLE /variable/CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE
/variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE
/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX /variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX
/variable/CMAKE_NO_BUILTIN_CHRPATH /variable/CMAKE_NO_BUILTIN_CHRPATH
/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED /variable/CMAKE_NO_SYSTEM_FROM_IMPORTED

View File

@@ -1,6 +0,0 @@
CMAKE_NINJA_CROSS_CONFIG_ENABLE
-------------------------------
If this variable is enabled, cross-configuration building is enabled in the
:generator:`Ninja Multi-Config` generator. See the generator's description for
more details.

View File

@@ -0,0 +1,10 @@
CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE
-------------------------------------
If this variable is enabled, cross-configuration building is enabled in the
:generator:`Ninja Multi-Config` generator. See the generator's description for
more details. This variable is ``OFF`` by default.
This variable is meant to be set from the command line (via
``-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE:BOOL=ON``) and should not be set from
project code.

View File

@@ -2203,7 +2203,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
bool cmGlobalNinjaGenerator::EnableCrossConfigBuild() const bool cmGlobalNinjaGenerator::EnableCrossConfigBuild() const
{ {
return this->IsMultiConfig() && return this->IsMultiConfig() &&
this->Makefiles.front()->IsOn("CMAKE_NINJA_CROSS_CONFIG_ENABLE"); this->Makefiles.front()->IsOn("CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE");
} }
int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,

View File

@@ -76,7 +76,7 @@ endfunction()
set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Simple-build) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Simple-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE=RelWithDebInfo;-DCMAKE_NINJA_CROSS_CONFIG_ENABLE=ON") set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE=RelWithDebInfo;-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON")
run_cmake_configure(Simple) run_cmake_configure(Simple)
unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
@@ -117,7 +117,7 @@ run_ninja(SimpleNoCross all-all build-Debug.ninja all:all)
run_cmake_build(SimpleNoCross all-clean Debug clean:all) run_cmake_build(SimpleNoCross all-clean Debug clean:all)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_CROSS_CONFIG_ENABLE=ON") set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON")
run_cmake_configure(CustomCommandGenerator) run_cmake_configure(CustomCommandGenerator)
unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
@@ -134,7 +134,7 @@ run_ninja(CustomCommandGenerator release-in-debug-graph build-Debug.ninja genera
run_cmake_command(CustomCommandGenerator-release-in-debug-graph-generated "${TARGET_FILE_generated_Release}") run_cmake_command(CustomCommandGenerator-release-in-debug-graph-generated "${TARGET_FILE_generated_Release}")
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandsAndTargets-build) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandsAndTargets-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_CROSS_CONFIG_ENABLE=ON") set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON")
run_cmake_configure(CustomCommandsAndTargets) run_cmake_configure(CustomCommandsAndTargets)
unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
@@ -150,7 +150,7 @@ run_cmake_build(CustomCommandsAndTargets debug-targetpostbuild Debug TopTargetPo
run_ninja(CustomCommandsAndTargets release-targetpostbuild build-Release.ninja SubdirTargetPostBuild) run_ninja(CustomCommandsAndTargets release-targetpostbuild build-Release.ninja SubdirTargetPostBuild)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PostfixAndLocation-build) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PostfixAndLocation-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_NINJA_CROSS_CONFIG_ENABLE=ON") set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON")
run_cmake_configure(PostfixAndLocation) run_cmake_configure(PostfixAndLocation)
unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
@@ -165,14 +165,14 @@ run_ninja(Clean release-notall build-Release.ninja exenotall)
run_cmake_build(Clean release-clean Release clean) run_cmake_build(Clean release-clean Release clean)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AdditionalCleanFiles-build) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AdditionalCleanFiles-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_CROSS_CONFIG_ENABLE=ON") set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON")
run_cmake_configure(AdditionalCleanFiles) run_cmake_configure(AdditionalCleanFiles)
unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OPTIONS)
run_cmake_build(AdditionalCleanFiles release-clean Release clean) run_cmake_build(AdditionalCleanFiles release-clean Release clean)
run_ninja(AdditionalCleanFiles all-clean build-Debug.ninja clean:all) run_ninja(AdditionalCleanFiles all-clean build-Debug.ninja clean:all)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Install-build) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Install-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install;-DCMAKE_NINJA_CROSS_CONFIG_ENABLE=ON") set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install;-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON")
run_cmake_configure(Install) run_cmake_configure(Install)
unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
@@ -194,7 +194,7 @@ endif()
if(CMake_TEST_Qt5) if(CMake_TEST_Qt5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5-build) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_CROSS_CONFIG_ENABLE=ON") set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON")
run_cmake_configure(Qt5) run_cmake_configure(Qt5)
unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)