mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
Some RunCMake tests unset some environment variables that affect ctest's behavior before running it. Any test using the RunCTest helper needs to do this, so do it in the helper itself. Issue: #24153
30 lines
1.1 KiB
CMake
30 lines
1.1 KiB
CMake
include(RunCMake)
|
|
|
|
# Isolate our ctest runs from external environment.
|
|
unset(ENV{CTEST_PARALLEL_LEVEL})
|
|
unset(ENV{CTEST_OUTPUT_ON_FAILURE})
|
|
|
|
function(run_ctest CASE_NAME)
|
|
configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in
|
|
${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake @ONLY)
|
|
if(EXISTS "${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in")
|
|
configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in
|
|
${RunCMake_BINARY_DIR}/${CASE_NAME}/CTestConfig.cmake @ONLY)
|
|
else()
|
|
file(REMOVE ${RunCMake_BINARY_DIR}/${CASE_NAME}/CTestConfig.cmake)
|
|
endif()
|
|
configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in
|
|
${RunCMake_BINARY_DIR}/${CASE_NAME}/CMakeLists.txt @ONLY)
|
|
if(NOT DEFINED RunCTest_VERBOSE_FLAG)
|
|
set(RunCTest_VERBOSE_FLAG "-V")
|
|
endif()
|
|
run_cmake_command(${CASE_NAME} ${CMAKE_CTEST_COMMAND}
|
|
-C Debug
|
|
-S ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake
|
|
${RunCTest_VERBOSE_FLAG}
|
|
--output-log ${RunCMake_BINARY_DIR}/${CASE_NAME}-build/testOutput.log
|
|
--no-compress-output
|
|
${ARGN}
|
|
)
|
|
endfunction()
|