summaryrefslogtreecommitdiffstats
path: root/Tests/CustomCommand/CMakeLists.txt
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-11-05 20:37:52 (GMT)
committerBrad King <brad.king@kitware.com>2014-11-14 16:55:09 (GMT)
commitfe5d6e8c0f2e37bac0621a3b976d95c471891f38 (patch)
tree56d2a66bbf625ed8f3274baf3632aab2337dd6f1 /Tests/CustomCommand/CMakeLists.txt
parentad6ee426278ebaa9518af4573362a96b0544f4f7 (diff)
downloadCMake-fe5d6e8c0f2e37bac0621a3b976d95c471891f38.zip
CMake-fe5d6e8c0f2e37bac0621a3b976d95c471891f38.tar.gz
CMake-fe5d6e8c0f2e37bac0621a3b976d95c471891f38.tar.bz2
Add USES_TERMINAL option for custom commands
Teach the add_custom_command and add_custom_target commands a new USES_TERMINAL option. Use it to tell the generator to give the command direct access to the terminal if possible.
Diffstat (limited to 'Tests/CustomCommand/CMakeLists.txt')
-rw-r--r--Tests/CustomCommand/CMakeLists.txt23
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index b97cd16..e260070 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -483,3 +483,26 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}")
add_library(NormDepends "${gen_file}")
+
+# Test that USES_TERMINAL is parsed correctly.
+# It seems much more difficult to test that USES_TERMINAL actually gives
+# the subprocess console access, as test output is piped through CTest,
+# and CTest itself might not be connected to the console.
+
+set(gen_file "${gen_path}/bar2.cxx")
+
+add_custom_command(
+ OUTPUT "${gen_file}"
+ DEPENDS "${gen_path}"
+ COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}"
+ VERBATIM
+ USES_TERMINAL
+)
+
+add_library(UseConsole "${gen_file}")
+
+add_custom_target(UseConsoleTarget ALL
+ COMMAND ${CMAKE_COMMAND} -E echo "Custom console target."
+ VERBATIM
+ USES_TERMINAL
+)