diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-10-06 18:40:32 (GMT) |
---|---|---|
committer | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-10-11 16:10:18 (GMT) |
commit | 5ba51621af43dbb84a12a5eff6740f45b8ab0cb0 (patch) | |
tree | 8bc95c99ef20874120e08df842700e5a0ec03d2f /Tests | |
parent | 7629a1182cf9006e4e83c1094794d935503dd079 (diff) | |
download | CMake-5ba51621af43dbb84a12a5eff6740f45b8ab0cb0.zip CMake-5ba51621af43dbb84a12a5eff6740f45b8ab0cb0.tar.gz CMake-5ba51621af43dbb84a12a5eff6740f45b8ab0cb0.tar.bz2 |
try_compile: Propagate --trace through try_compile
Add ability to specify another cmake instance from which to get the
trace output target. Use this during try_compile.
Diffstat (limited to 'Tests')
5 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index a2eeddf..50b1f90 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -940,6 +940,7 @@ unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS --trace) run_cmake(trace) +run_cmake(trace-try_compile) unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS --trace-expand) @@ -952,6 +953,7 @@ unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS --trace-redirect=${RunCMake_BINARY_DIR}/redirected.trace) run_cmake(trace-redirect) +run_cmake(trace-try_compile-redirect) unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS --trace-redirect=/no/such/file.txt) diff --git a/Tests/RunCMake/CommandLine/trace-try_compile-redirect-check.cmake b/Tests/RunCMake/CommandLine/trace-try_compile-redirect-check.cmake new file mode 100644 index 0000000..94a7c95 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-try_compile-redirect-check.cmake @@ -0,0 +1,13 @@ +file(READ ${RunCMake_SOURCE_DIR}/trace-try_compile-stderr.txt expected_content) +string(REGEX REPLACE "\n+$" "" expected_content "${expected_content}") + +file(READ ${RunCMake_BINARY_DIR}/redirected.trace actual_content) +string(REGEX REPLACE "\r\n" "\n" actual_content "${actual_content}") +string(REGEX REPLACE "\n+$" "" actual_content "${actual_content}") +if(NOT "${actual_content}" MATCHES "${expected_content}") + set(RunCMake_TEST_FAILED + "Trace file content does not match that expected." + "Expected to match:\n${expected_content}\n" + "Actual content:\n${actual_content}\n" + ) +endif() diff --git a/Tests/RunCMake/CommandLine/trace-try_compile-redirect.cmake b/Tests/RunCMake/CommandLine/trace-try_compile-redirect.cmake new file mode 100644 index 0000000..982cb89 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-try_compile-redirect.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.24) +project(test C) diff --git a/Tests/RunCMake/CommandLine/trace-try_compile-stderr.txt b/Tests/RunCMake/CommandLine/trace-try_compile-stderr.txt new file mode 100644 index 0000000..1674b8f --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-try_compile-stderr.txt @@ -0,0 +1,4 @@ +.*Modules/CMakeDetermineCompilerABI.cmake\([0-9]+\): try_compile\([^)]+\) +.*Tests/RunCMake/CommandLine/trace-try_compile(-redirect)?-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+/CMakeLists.txt\([0-9]+\): cmake_minimum_required.* +.*Tests/RunCMake/CommandLine/trace-try_compile(-redirect)?-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+/CMakeLists.txt\([0-9]+\): project\(CMAKE_TRY_COMPILE.* +.*Tests/RunCMake/CommandLine/trace-try_compile(-redirect)?-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+/CMakeLists.txt\([0-9]+\): add_executable\(cmTC_.* diff --git a/Tests/RunCMake/CommandLine/trace-try_compile.cmake b/Tests/RunCMake/CommandLine/trace-try_compile.cmake new file mode 100644 index 0000000..982cb89 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-try_compile.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.24) +project(test C) |