diff options
author | Roger Leigh <rleigh@dundee.ac.uk> | 2017-12-14 16:09:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-02-06 18:24:46 (GMT) |
commit | 22e8b3af041f49842aeafa2d97129f422404d7de (patch) | |
tree | 3d2c76d931789a162114d38023faeeea1cc90760 /Tests/CommandLength | |
parent | f7c08c333b3ccd86134f73a8a3df5bf59c53bdd8 (diff) | |
download | CMake-22e8b3af041f49842aeafa2d97129f422404d7de.zip CMake-22e8b3af041f49842aeafa2d97129f422404d7de.tar.gz CMake-22e8b3af041f49842aeafa2d97129f422404d7de.tar.bz2 |
Ninja: Generate scripts for long custom command sequences
Ninja runs just one command line for every build statement, so the Ninja
generator needs to `&&`-chain multiple commands together into one long
string. For long custom command sequences this can exceed the maximum
command-line length for the operating system. In such cases, write the
commands out to a script instead, and then run the script from Ninja's
one command line.
Co-Author: Brad King <brad.king@kitware.com>
Fixes: #15612
Diffstat (limited to 'Tests/CommandLength')
-rw-r--r-- | Tests/CommandLength/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/CommandLength/test.c | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/Tests/CommandLength/CMakeLists.txt b/Tests/CommandLength/CMakeLists.txt new file mode 100644 index 0000000..6836051 --- /dev/null +++ b/Tests/CommandLength/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.10) +project(CommandLength C) + +add_executable(CommandLength test.c) +add_custom_command(TARGET CommandLength POST_BUILD VERBATIM + COMMAND ${CMAKE_COMMAND} -E make_directory log) + +set(msg "xxxx $$$$ yyyy") +set(msg "${msg} ${msg}") +set(msg "${msg} ${msg}") +set(msg "${msg} ${msg}") +set(msg "${msg} ${msg}") +foreach(i RANGE 1 1000) + add_custom_command(TARGET CommandLength POST_BUILD VERBATIM + COMMAND ${CMAKE_COMMAND} -E echo "${i} ${msg}" > log/${i} + ) +endforeach() diff --git a/Tests/CommandLength/test.c b/Tests/CommandLength/test.c new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/CommandLength/test.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} |