mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
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
18 lines
504 B
CMake
18 lines
504 B
CMake
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()
|