diff options
author | Brad King <brad.king@kitware.com> | 2019-01-21 12:53:47 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-21 12:54:06 (GMT) |
commit | eadaf0c8c3b4112d38a19b20a9d303e83640373d (patch) | |
tree | c87f87389c3ff585b042e5f0f45a4c15ea2609ac | |
parent | 1fba410ecf168ab4af500943608a5fb4fad5dc06 (diff) | |
parent | 264bdac185f85e0508982df1b6efd7c3b8a1d1a4 (diff) | |
download | CMake-eadaf0c8c3b4112d38a19b20a9d303e83640373d.zip CMake-eadaf0c8c3b4112d38a19b20a9d303e83640373d.tar.gz CMake-eadaf0c8c3b4112d38a19b20a9d303e83640373d.tar.bz2 |
Merge topic 'cmake-role-fix'
264bdac185 CMAKE_ROLE: Fix value for ctest --build-and-test
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2820
4 files changed, 20 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 6496af8..312d126 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -164,7 +164,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) return 1; } - cmake cm(cmake::RoleProject, cmState::CTest); + cmake cm(cmake::RoleProject, cmState::Project); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); std::string cmakeOutString; diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/BuildAndTest/CMakeLists.txt b/Tests/RunCMake/CMakeRoleGlobalProperty/BuildAndTest/CMakeLists.txt new file mode 100644 index 0000000..332b023 --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/BuildAndTest/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.12) +project(CMakeRoleGlobalPropertyBuildAndTest NONE) +include(CTest) + +get_property(role GLOBAL PROPERTY CMAKE_ROLE) +if(NOT role STREQUAL "PROJECT") + message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"PROJECT\"") +endif() + +add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in b/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in index 913239c..bb8f9c1 100644 --- a/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) -project(CTestStart@CASE_NAME@ NONE) +cmake_minimum_required(VERSION 3.12) +project(CMakeRoleGlobalProperty@CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake b/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake index b840317..3cbd51d 100644 --- a/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake @@ -5,3 +5,10 @@ run_cmake(Project) run_cmake_command(Script "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/Script.cmake") run_cmake_command(FindPackage "${CMAKE_COMMAND}" --find-package -DNAME=DummyPackage -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}") run_ctest(CTest) +run_cmake_command(BuildAndTest "${CMAKE_CTEST_COMMAND}" + --build-and-test + "${RunCMake_SOURCE_DIR}/BuildAndTest" + "${RunCMake_BINARY_DIR}/BuildAndTest-build" + --build-project CMakeRoleGlobalPropertyBuildAndTest + --build-generator "${RunCMake_GENERATOR}" + ) |