diff options
author | Brad King <brad.king@kitware.com> | 2024-05-31 14:20:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-06-01 10:28:26 (GMT) |
commit | 7330121467e9da7a6845de005264ecec980133e5 (patch) | |
tree | a9c2000e97bd600ddccbd37e1ced9de561e553c8 /Tests/RunCMake | |
parent | 719b461b9c5a79f2946ee010deb16dd130570ada (diff) | |
download | CMake-7330121467e9da7a6845de005264ecec980133e5.zip CMake-7330121467e9da7a6845de005264ecec980133e5.tar.gz CMake-7330121467e9da7a6845de005264ecec980133e5.tar.bz2 |
Fix crash in target-specific commands called from initial cache script
Fixes: #26018
Diffstat (limited to 'Tests/RunCMake')
6 files changed, 57 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/C_target-commands-result.txt b/Tests/RunCMake/CommandLine/C_target-commands-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_target-commands-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/C_target-commands-stderr.txt b/Tests/RunCMake/CommandLine/C_target-commands-stderr.txt new file mode 100644 index 0000000..8e811a6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_target-commands-stderr.txt @@ -0,0 +1,44 @@ +^CMake Error at [^ +]*C_target-commands_initial-cache\.cmake:[0-9]+ \(target_sources\): + Cannot specify sources for target "DoesNotExist" which is not built by this + project\. ++ +CMake Error at [^ +]*C_target-commands_initial-cache\.cmake:[0-9]+ \(target_compile_definitions\): + Cannot specify compile definitions for target "DoesNotExist" which is not + built by this project\. ++ +CMake Error at [^ +]*C_target-commands_initial-cache\.cmake:[0-9]+ \(target_compile_features\): + Cannot specify compile features for target "DoesNotExist" which is not + built by this project\. ++ +CMake Error at [^ +]*C_target-commands_initial-cache\.cmake:[0-9]+ \(target_compile_options\): + Cannot specify compile options for target "DoesNotExist" which is not built + by this project\. ++ +CMake Error at [^ +]*C_target-commands_initial-cache\.cmake:[0-9]+ \(target_include_directories\): + Cannot specify include directories for target "DoesNotExist" which is not + built by this project\. ++ +CMake Error at [^ +]*C_target-commands_initial-cache\.cmake:[0-9]+ \(target_precompile_headers\): + Cannot specify precompile headers for target "DoesNotExist" which is not + built by this project\. ++ +CMake Error at [^ +]*C_target-commands_initial-cache\.cmake:[0-9]+ \(target_link_directories\): + Cannot specify link directories for target "DoesNotExist" which is not + built by this project\. ++ +CMake Error at [^ +]*C_target-commands_initial-cache\.cmake:[0-9]+ \(target_link_options\): + Cannot specify link options for target "DoesNotExist" which is not built by + this project\. ++ +CMake Error at [^ +]*C_target-commands_initial-cache\.cmake:[0-9]+ \(target_link_libraries\): + Cannot specify link libraries for target "DoesNotExist" which is not built + by this project\.$ diff --git a/Tests/RunCMake/CommandLine/C_target-commands-stdout.txt b/Tests/RunCMake/CommandLine/C_target-commands-stdout.txt new file mode 100644 index 0000000..beaa2c6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_target-commands-stdout.txt @@ -0,0 +1 @@ +loading initial cache file \.\./C_target-commands_initial-cache\.cmake diff --git a/Tests/RunCMake/CommandLine/C_target-commands.cmake b/Tests/RunCMake/CommandLine/C_target-commands.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_target-commands.cmake diff --git a/Tests/RunCMake/CommandLine/C_target-commands_initial-cache.cmake b/Tests/RunCMake/CommandLine/C_target-commands_initial-cache.cmake new file mode 100644 index 0000000..a453334 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_target-commands_initial-cache.cmake @@ -0,0 +1,9 @@ +target_sources(DoesNotExist PRIVATE) +target_compile_definitions(DoesNotExist PRIVATE) +target_compile_features(DoesNotExist PRIVATE) +target_compile_options(DoesNotExist PRIVATE) +target_include_directories(DoesNotExist PRIVATE) +target_precompile_headers(DoesNotExist PRIVATE) +target_link_directories(DoesNotExist PRIVATE) +target_link_options(DoesNotExist PRIVATE) +target_link_libraries(DoesNotExist PRIVATE) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 8a5a25a..7a5a334 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -897,6 +897,8 @@ run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMa file(COPY ${RunCMake_SOURCE_DIR}/C_basic_initial-cache.txt DESTINATION ${RunCMake_BINARY_DIR}) run_cmake_with_options(C_basic -C ../C_basic_initial-cache.txt) run_cmake_with_options(C_basic_fullpath -C ${RunCMake_BINARY_DIR}/C_basic_initial-cache.txt) +file(COPY ${RunCMake_SOURCE_DIR}/C_target-commands_initial-cache.cmake DESTINATION ${RunCMake_BINARY_DIR}) +run_cmake_command(C_target-commands ${CMAKE_COMMAND} -S ${RunCMake_SOURCE_DIR} -DRunCMake_TEST=C_target-commands -C ../C_target-commands_initial-cache.cmake) set(RunCMake_TEST_OPTIONS "-DFOO=-DBAR:BOOL=BAZ") |