mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-16 20:21:41 -06:00
ctest: Populate CTEST_CONFIGURATION_TYPE from the -C command line when set
This commit is contained in:
committed by
Kyle Edwards
parent
c57bcf3b30
commit
e6f758be6d
5
Help/release/dev/ctest-configuration-type.rst
Normal file
5
Help/release/dev/ctest-configuration-type.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
ctest-configuration-type
|
||||
------------------------
|
||||
|
||||
* The :variable:`CTEST_CONFIGURATION_TYPE` variable is now set from the command
|
||||
line when :manual:`ctest(1)` is invoked with ``-C <cfg>``.
|
||||
@@ -3,3 +3,6 @@ CTEST_CONFIGURATION_TYPE
|
||||
|
||||
Specify the CTest ``DefaultCTestConfigurationType`` setting
|
||||
in a :manual:`ctest(1)` dashboard client script.
|
||||
|
||||
If the configuration type is set via ``-C <cfg>`` from the command line
|
||||
then this variable is populated accordingly.
|
||||
|
||||
@@ -340,6 +340,13 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
|
||||
this->SetRunCurrentScript(true);
|
||||
this->UpdateElapsedTime();
|
||||
|
||||
// set the CTEST_CONFIGURATION_TYPE variable to the current value of the
|
||||
// the -C argument on the command line.
|
||||
if (!this->CTest->GetConfigType().empty()) {
|
||||
this->Makefile->AddDefinition("CTEST_CONFIGURATION_TYPE",
|
||||
this->CTest->GetConfigType());
|
||||
}
|
||||
|
||||
// add the script arg if defined
|
||||
if (!script_arg.empty()) {
|
||||
this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg);
|
||||
|
||||
4
Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in
Normal file
4
Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in
Normal file
@@ -0,0 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(CTestCommandLine@CASE_NAME@ NONE)
|
||||
include(CTest)
|
||||
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
|
||||
@@ -1,4 +1,6 @@
|
||||
include(RunCMake)
|
||||
include(RunCTest)
|
||||
|
||||
set(RunCMake_TEST_TIMEOUT 60)
|
||||
|
||||
unset(ENV{CTEST_PARALLEL_LEVEL})
|
||||
@@ -311,3 +313,6 @@ function(run_ShowOnly)
|
||||
run_cmake_command(show-only_json-v1 ${CMAKE_CTEST_COMMAND} --show-only=json-v1)
|
||||
endfunction()
|
||||
run_ShowOnly()
|
||||
|
||||
# Check the configuration type variable is passed
|
||||
run_ctest(check-configuration-type)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Command line CTEST_CONFIGURATION_TYPE=Debug
|
||||
set CTEST_CONFIGURATION_TYPE=Release
|
||||
19
Tests/RunCMake/CTestCommandLine/test.cmake.in
Normal file
19
Tests/RunCMake/CTestCommandLine/test.cmake.in
Normal file
@@ -0,0 +1,19 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
set(CTEST_SITE "test-site")
|
||||
set(CTEST_BUILD_NAME "test-build-name")
|
||||
set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
|
||||
set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
|
||||
set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
|
||||
set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
|
||||
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
|
||||
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
|
||||
set(CTEST_COMMAND "@CMAKE_CTEST_COMMAND@")
|
||||
|
||||
if("@CASE_NAME@" MATCHES "^check-configuration-type")
|
||||
message("Command line CTEST_CONFIGURATION_TYPE=" ${CTEST_CONFIGURATION_TYPE})
|
||||
set(CTEST_CONFIGURATION_TYPE "Release")
|
||||
message("set CTEST_CONFIGURATION_TYPE=" ${CTEST_CONFIGURATION_TYPE})
|
||||
|
||||
ctest_start(Experimental)
|
||||
endif()
|
||||
Reference in New Issue
Block a user