summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-06-23 13:23:48 +0000
committerKitware Robot <kwrobot@kitware.com>2022-06-23 09:23:55 -0400
commitfd83847b14d34d6b81a9fd9be863003ac5fa1e00 (patch)
tree2d95b867cea04bbe60429837670fc27def1f050f
parent46305219eb3df545b2dd19128ffb1a24d081b2a8 (diff)
parent9a0a94fdaaa04474ff37cb2896cda640d8013b43 (diff)
downloadcmake-fd83847b14d34d6b81a9fd9be863003ac5fa1e00.tar.gz
Merge topic 'vs-compile-batching' into release-3.24
9a0a94fdaa VS: Add variable to to turn off Visual Studio compile batching a7ebb73929 Help: Improve formatting in VS_NO_COMPILE_BATCHING docs Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7405
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/prop_tgt/VS_NO_COMPILE_BATCHING.rst11
-rw-r--r--Help/release/3.24.rst9
-rw-r--r--Help/variable/CMAKE_VS_NO_COMPILE_BATCHING.rst20
-rw-r--r--Source/cmTarget.cxx1
-rw-r--r--Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake2
6 files changed, 35 insertions, 9 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 9fbb146f2e..7c8a7fac74 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -516,6 +516,7 @@ Variables that Control the Build
/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD
/variable/CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD
/variable/CMAKE_VS_JUST_MY_CODE_DEBUGGING
+ /variable/CMAKE_VS_NO_COMPILE_BATCHING
/variable/CMAKE_VS_SDK_EXCLUDE_DIRECTORIES
/variable/CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES
/variable/CMAKE_VS_SDK_INCLUDE_DIRECTORIES
diff --git a/Help/prop_tgt/VS_NO_COMPILE_BATCHING.rst b/Help/prop_tgt/VS_NO_COMPILE_BATCHING.rst
index f8a9fa64b0..e14ae58816 100644
--- a/Help/prop_tgt/VS_NO_COMPILE_BATCHING.rst
+++ b/Help/prop_tgt/VS_NO_COMPILE_BATCHING.rst
@@ -6,14 +6,17 @@ VS_NO_COMPILE_BATCHING
Turn off compile batching for the target. Usually MSBuild calls the compiler
with multiple c/cpp files and compiler starts subprocesses for each file to
make the build parallel. If you want compiler to be invoked with one file at
-a time set VS_NO_COMPILE_BATCHING to ON. If this flag is set MSBuild will call
-compiler with one c/cpp file at a time. Useful when you want to use tool that
-replaces the compiler, for example some build caching tool.
+a time set ``VS_NO_COMPILE_BATCHING`` to ON. If this flag is set MSBuild will
+call compiler with one c/cpp file at a time. Useful when you want to use tool
+that replaces the compiler, for example some build caching tool.
+
+This property is initialized by the :variable:`CMAKE_VS_NO_COMPILE_BATCHING`
+variable if it is set when a target is created.
Example
^^^^^^^
-This shows setting the variable for the target foo.
+This shows setting the property for the target ``foo``.
.. code-block:: cmake
diff --git a/Help/release/3.24.rst b/Help/release/3.24.rst
index 63f88a99e5..2e165feec0 100644
--- a/Help/release/3.24.rst
+++ b/Help/release/3.24.rst
@@ -154,6 +154,11 @@ Variables
were added to enable build rules that verify all headers in header sets
can be used on their own.
+* The :variable:`CMAKE_VS_NO_COMPILE_BATCHING` variable and corresponding
+ :prop_tgt:`VS_NO_COMPILE_BATCHING` target property were added to
+ tell :ref:`Visual Studio Generators` whether to disable compiler
+ parallelism and call the compiler with one source file at a time.
+
* The :variable:`CMAKE_WATCOM_RUNTIME_LIBRARY` variable and
:prop_tgt:`WATCOM_RUNTIME_LIBRARY` target property were introduced to
select the runtime library used by compilers targeting the Watcom ABI.
@@ -185,10 +190,6 @@ Properties
than one ``static void Main(string[])`` function signature is available
in a managed .NET project.
-* The :prop_tgt:`VS_NO_COMPILE_BATCHING` target property was added to
- tell :ref:`Visual Studio Generators` whether to disable compiler parallelism
- and call the compiler with one source file at a time.
-
Modules
-------
diff --git a/Help/variable/CMAKE_VS_NO_COMPILE_BATCHING.rst b/Help/variable/CMAKE_VS_NO_COMPILE_BATCHING.rst
new file mode 100644
index 0000000000..2fb163ed74
--- /dev/null
+++ b/Help/variable/CMAKE_VS_NO_COMPILE_BATCHING.rst
@@ -0,0 +1,20 @@
+CMAKE_VS_NO_COMPILE_BATCHING
+----------------------------
+
+.. versionadded:: 3.24
+
+Turn off compile batching when using :ref:`Visual Studio Generators`.
+
+This variable is used to initialize the :prop_tgt:`VS_NO_COMPILE_BATCHING`
+property on all targets when they are created. See that target property for
+additional information.
+
+Example
+^^^^^^^
+
+This shows setting the property for the target ``foo`` using the variable.
+
+.. code-block:: cmake
+
+ set(CMAKE_VS_NO_COMPILE_BATCHING ON)
+ add_library(foo SHARED foo.cpp)
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 83dc1c258d..a8cd619367 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -583,6 +583,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("Swift_LANGUAGE_VERSION");
initProp("Swift_MODULE_DIRECTORY");
initProp("VS_JUST_MY_CODE_DEBUGGING");
+ initProp("VS_NO_COMPILE_BATCHING");
initProp("DISABLE_PRECOMPILE_HEADERS");
initProp("UNITY_BUILD");
initProp("UNITY_BUILD_UNIQUE_ID");
diff --git a/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake b/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake
index c96edce7ab..b405136a2e 100644
--- a/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake
+++ b/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake
@@ -2,8 +2,8 @@ enable_language(CXX)
add_library(foo foo.cpp)
+set(CMAKE_VS_NO_COMPILE_BATCHING ON)
add_library(foo_NB foo.cpp)
-set_property(TARGET foo_NB PROPERTY VS_NO_COMPILE_BATCHING ON)
add_library(foo_NB_OFF foo.cpp)
set_property(TARGET foo_NB_OFF PROPERTY VS_NO_COMPILE_BATCHING OFF)