diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2019-12-11 15:59:41 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-12-11 16:00:13 (GMT) |
commit | 106137492b2d396e292745c2cb344d414640d6be (patch) | |
tree | c097ccbeb5cbefe2a739cbac360a302d79566d8a | |
parent | 651b5d157ae43c07e743af94ebf71b624734c4d5 (diff) | |
parent | e6f758be6dcd11e901ed86f56c4fdd7e7cb86cca (diff) | |
download | CMake-106137492b2d396e292745c2cb344d414640d6be.zip CMake-106137492b2d396e292745c2cb344d414640d6be.tar.gz CMake-106137492b2d396e292745c2cb344d414640d6be.tar.bz2 |
Merge topic 'ctest-configuration-type'
e6f758be6d ctest: Populate CTEST_CONFIGURATION_TYPE from the -C command line when set
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4109
-rw-r--r-- | Help/release/dev/ctest-configuration-type.rst | 5 | ||||
-rw-r--r-- | Help/variable/CTEST_CONFIGURATION_TYPE.rst | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 7 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/check-configuration-type-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/test.cmake.in | 19 |
7 files changed, 45 insertions, 0 deletions
diff --git a/Help/release/dev/ctest-configuration-type.rst b/Help/release/dev/ctest-configuration-type.rst new file mode 100644 index 0000000..89e36c4 --- /dev/null +++ b/Help/release/dev/ctest-configuration-type.rst @@ -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>``. diff --git a/Help/variable/CTEST_CONFIGURATION_TYPE.rst b/Help/variable/CTEST_CONFIGURATION_TYPE.rst index c905480..9e277fa 100644 --- a/Help/variable/CTEST_CONFIGURATION_TYPE.rst +++ b/Help/variable/CTEST_CONFIGURATION_TYPE.rst @@ -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. diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 60facbd..7803e37 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -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); diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in new file mode 100644 index 0000000..5437800 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in @@ -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) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 0953504..b2de596 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -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) diff --git a/Tests/RunCMake/CTestCommandLine/check-configuration-type-stderr.txt b/Tests/RunCMake/CTestCommandLine/check-configuration-type-stderr.txt new file mode 100644 index 0000000..b2c1a45 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/check-configuration-type-stderr.txt @@ -0,0 +1,2 @@ +Command line CTEST_CONFIGURATION_TYPE=Debug +set CTEST_CONFIGURATION_TYPE=Release diff --git a/Tests/RunCMake/CTestCommandLine/test.cmake.in b/Tests/RunCMake/CTestCommandLine/test.cmake.in new file mode 100644 index 0000000..b82968a --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test.cmake.in @@ -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() |