diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2019-01-17 17:02:11 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2019-01-18 15:15:25 (GMT) |
commit | 264bdac185f85e0508982df1b6efd7c3b8a1d1a4 (patch) | |
tree | 0488fc03bcad00b4cb2db868f08e8977b32030f8 /Tests | |
parent | 68e20f674a48be38d60e129f600faf7c483f2b97 (diff) | |
download | CMake-264bdac185f85e0508982df1b6efd7c3b8a1d1a4.zip CMake-264bdac185f85e0508982df1b6efd7c3b8a1d1a4.tar.gz CMake-264bdac185f85e0508982df1b6efd7c3b8a1d1a4.tar.bz2 |
CMAKE_ROLE: Fix value for ctest --build-and-test
--build-and-test builds a CMake project, so CMAKE_ROLE should be
PROJECT. Fix this and add a test case.
Diffstat (limited to 'Tests')
3 files changed, 19 insertions, 2 deletions
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}" + ) |