Commit 19beee46 authored by Bill Hoffman's avatar Bill Hoffman Committed by Brad King

ctest_configure: Propagate CTEST_USE_LAUNCHERS from caller to project

If `CTEST_USE_LAUNCHERS` is `TRUE` in a CTest script then the
`ctest_configure` command will add `-DCTEST_USE_LAUNCHERS:BOOL=TRUE` to
the cmake command used to configure the project.  This allows a project
to only set `CTEST_USE_LAUNCHERS` in a ctest script and have launchers
work.
parent b2cf1cba
Pipeline #31244 passed with stage
......@@ -24,7 +24,9 @@
# include(CTestUseLaunchers), it will use the value of the ENV variable
# to initialize a CTEST_USE_LAUNCHERS cache variable. This cache
# variable initialization only occurs if CTEST_USE_LAUNCHERS is not
# already defined.
# already defined. If CTEST_USE_LAUNCHERS is on in a ctest -S script
# the ctest_configure command will add -DCTEST_USE_LAUNCHERS:BOOL=TRUE
# to the cmake command used to configure the project.
if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT})
set(CTEST_USE_LAUNCHERS "$ENV{CTEST_USE_LAUNCHERS_DEFAULT}"
......
......@@ -102,6 +102,10 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
cmakeConfigureCommand += "\"";
}
if (this->Makefile->IsOn("CTEST_USE_LAUNCHERS")) {
cmakeConfigureCommand += " \"-DCTEST_USE_LAUNCHERS:BOOL=TRUE\"";
}
cmakeConfigureCommand += " \"-G";
cmakeConfigureCommand += cmakeGeneratorName;
cmakeConfigureCommand += "\"";
......
cmake_minimum_required(VERSION 3.1)
@CASE_CMAKELISTS_PREFIX_CODE@
project(CTestBuild@CASE_NAME@ NONE)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
......
......@@ -12,6 +12,11 @@ run_ctest_build(BuildQuiet QUIET)
function(run_BuildFailure)
set(CASE_CMAKELISTS_SUFFIX_CODE [[
add_custom_target(BuildFailure ALL COMMAND command-does-not-exist)
]])
set(CASE_CMAKELISTS_PREFIX_CODE [[
if(NOT CTEST_USE_LAUNCHERS)
message(FATAL_ERROR "CTEST_USE_LAUNCHERS not set")
endif()
]])
set(CASE_TEST_PREFIX_CODE [[
cmake_policy(SET CMP0061 NEW)
......
......@@ -9,6 +9,7 @@ set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
set(CTEST_USE_LAUNCHERS TRUE)
set(ctest_build_args "@CASE_CTEST_BUILD_ARGS@")
ctest_start(Experimental)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment