summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Ninja
diff options
context:
space:
mode:
authorRosen Matev <r.matev@gmail.com>2019-05-10 12:37:39 (GMT)
committerRosen Matev <r.matev@gmail.com>2019-05-14 13:58:00 (GMT)
commit9f76961de87d8911d13867d469c38087e47a0b60 (patch)
tree13cf78b16bcbf13e6a4aef6b6963c38137083b21 /Tests/RunCMake/Ninja
parent5a2023f904c5da80a4614c133b7d7d8f4f719e96 (diff)
downloadCMake-9f76961de87d8911d13867d469c38087e47a0b60.zip
CMake-9f76961de87d8911d13867d469c38087e47a0b60.tar.gz
CMake-9f76961de87d8911d13867d469c38087e47a0b60.tar.bz2
Support job pools in custom commands and targets
Provide a way for custom commands and targets to set the pool variable of the ninja build statement. Setting `JOB_POOL` is not compatible with `USES_TERMINAL`, which implies the `console` pool. The option is silently ignored with other generators. Closes: #18483
Diffstat (limited to 'Tests/RunCMake/Ninja')
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandJobPool-check.cmake8
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandJobPool.cmake17
-rw-r--r--Tests/RunCMake/Ninja/JobPoolUsesTerminal-result.txt1
-rw-r--r--Tests/RunCMake/Ninja/JobPoolUsesTerminal-stderr.txt9
-rw-r--r--Tests/RunCMake/Ninja/JobPoolUsesTerminal.cmake2
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake2
6 files changed, 39 insertions, 0 deletions
diff --git a/Tests/RunCMake/Ninja/CustomCommandJobPool-check.cmake b/Tests/RunCMake/Ninja/CustomCommandJobPool-check.cmake
new file mode 100644
index 0000000..7f7fa33
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CustomCommandJobPool-check.cmake
@@ -0,0 +1,8 @@
+set(log "${RunCMake_BINARY_DIR}/CustomCommandJobPool-build/build.ninja")
+file(READ "${log}" build_file)
+if(NOT "${build_file}" MATCHES "pool = custom_command_pool")
+ set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected line: pool = custom_command_pool")
+endif()
+if(NOT "${build_file}" MATCHES "pool = custom_target_pool")
+ set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected line: pool = custom_target_pool")
+endif()
diff --git a/Tests/RunCMake/Ninja/CustomCommandJobPool.cmake b/Tests/RunCMake/Ninja/CustomCommandJobPool.cmake
new file mode 100644
index 0000000..1e36e65
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CustomCommandJobPool.cmake
@@ -0,0 +1,17 @@
+add_custom_command(
+ OUTPUT hello.copy.c
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
+ hello.copy.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ JOB_POOL "custom_command_pool"
+ )
+add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hello.copy.c")
+
+add_custom_target(
+ hello.echo
+ COMMAND echo
+ JOB_POOL "custom_target_pool"
+)
+
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/JobPoolUsesTerminal-result.txt b/Tests/RunCMake/Ninja/JobPoolUsesTerminal-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Ninja/JobPoolUsesTerminal-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Ninja/JobPoolUsesTerminal-stderr.txt b/Tests/RunCMake/Ninja/JobPoolUsesTerminal-stderr.txt
new file mode 100644
index 0000000..45975ca
--- /dev/null
+++ b/Tests/RunCMake/Ninja/JobPoolUsesTerminal-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Error at JobPoolUsesTerminal.cmake:1 \(add_custom_command\):
+ add_custom_command JOB_POOL is shadowed by USES_TERMINAL.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at JobPoolUsesTerminal.cmake:2 \(add_custom_target\):
+ add_custom_target JOB_POOL is shadowed by USES_TERMINAL.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Ninja/JobPoolUsesTerminal.cmake b/Tests/RunCMake/Ninja/JobPoolUsesTerminal.cmake
new file mode 100644
index 0000000..b7e440c
--- /dev/null
+++ b/Tests/RunCMake/Ninja/JobPoolUsesTerminal.cmake
@@ -0,0 +1,2 @@
+add_custom_command(OUTPUT x COMMAND y USES_TERMINAL JOB_POOL z)
+add_custom_target(CustomTarget COMMAND y USES_TERMINAL JOB_POOL z)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 8fa650a..808a872 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -57,6 +57,8 @@ run_CMP0058(NEW-no)
run_CMP0058(NEW-by)
run_cmake(CustomCommandDepfile)
+run_cmake(CustomCommandJobPool)
+run_cmake(JobPoolUsesTerminal)
run_cmake(RspFileC)
run_cmake(RspFileCXX)