diff --git a/Help/release/dev/ExternalProject-install-jobserver.rst b/Help/release/dev/ExternalProject-install-jobserver.rst new file mode 100644 index 0000000000..7d8116c821 --- /dev/null +++ b/Help/release/dev/ExternalProject-install-jobserver.rst @@ -0,0 +1,7 @@ +ExternalProject-install-jobserver +--------------------------------- + +* The :module:`ExternalProject` module's :command:`ExternalProject_Add` + command gained an ``INSTALL_JOB_SERVER_AWARE`` option to enable + integration of the GNU Make job server when using an explicit + ``INSTALL_COMMAND`` with :ref:`Makefile Generators`. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 3f43542307..7d95bdf6d6 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -749,6 +749,14 @@ step. This can be overridden with custom install commands if required. install step's own underlying call to :command:`add_custom_command`, which has additional documentation. +``INSTALL_JOB_SERVER_AWARE `` + .. versionadded:: 3.32 + + Specifies that the install step is aware of the GNU Make job server. + See the :command:`add_custom_command` documentation of its + ``JOB_SERVER_AWARE`` option for details. This option is relevant + only when an explicit ``INSTALL_COMMAND`` is specified. + .. note:: If the :envvar:`CMAKE_INSTALL_MODE` environment variable is set when the main project is built, it will only have an effect if the following @@ -2819,6 +2827,16 @@ function(_ep_add_install_command name) PROPERTY _EP_INSTALL_BYPRODUCTS ) + get_property(install_job_server_aware + TARGET ${name} + PROPERTY _EP_INSTALL_JOB_SERVER_AWARE + ) + if(install_job_server_aware) + set(maybe_JOB_SERVER_AWARE "JOB_SERVER_AWARE 1") + else() + set(maybe_JOB_SERVER_AWARE "") + endif() + set(__cmdQuoted) foreach(__item IN LISTS cmd) string(APPEND __cmdQuoted " [==[${__item}]==]") @@ -2831,6 +2849,7 @@ function(_ep_add_install_command name) WORKING_DIRECTORY \${binary_dir} DEPENDEES build ALWAYS \${always} + ${maybe_JOB_SERVER_AWARE} ${log} ${uses_terminal} )" diff --git a/Modules/ExternalProject/shared_internal_commands.cmake b/Modules/ExternalProject/shared_internal_commands.cmake index 149a8a73f3..ac5d2bddc3 100644 --- a/Modules/ExternalProject/shared_internal_commands.cmake +++ b/Modules/ExternalProject/shared_internal_commands.cmake @@ -1934,6 +1934,7 @@ macro(_ep_get_add_keywords out_var) # INSTALL_COMMAND INSTALL_BYPRODUCTS + INSTALL_JOB_SERVER_AWARE # # Test step options # diff --git a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake index 55a9f0d80c..f1d621b33b 100644 --- a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake +++ b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake @@ -12,5 +12,6 @@ function(check target regex) endfunction() check("/CMakeFiles/Foo.dir/build.make" [[\+cd (/d )?"?.*"? && "?.*"? --build "?.*"?]]) +check("/CMakeFiles/Foo.dir/build.make" [[\+cd (/d )?"?.*"? && "?.*"? --install "?.*"?]]) check("/CMakeFiles/Foo.dir/build.make" [[\+cd (/d )?"?.*"? && "?.*"? -E touch "?.*"?]]) check("/CMakeFiles/Foo.dir/build.make" [[\+"?.*"? -E true]]) diff --git a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake index 3f688caf7a..077b929d08 100644 --- a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake +++ b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake @@ -1,9 +1,11 @@ include(ExternalProject) ExternalProject_Add(Foo SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Foo + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= BUILD_COMMAND ${CMAKE_COMMAND} --build BUILD_JOB_SERVER_AWARE 1 - INSTALL_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} --install + INSTALL_JOB_SERVER_AWARE 1 ) # Add a second step to test JOB_SERVER_AWARE