summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2019-02-26 19:48:13 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2019-02-26 19:52:17 (GMT)
commit4b95e7fe63d254b8e50f09f85a51e232a7470c7b (patch)
tree95051f83c03a03b638334f2e47cd2baf9345dee7
parent8455e166a9655afa70b34e3b5c9586470041e87c (diff)
downloadCMake-4b95e7fe63d254b8e50f09f85a51e232a7470c7b.zip
CMake-4b95e7fe63d254b8e50f09f85a51e232a7470c7b.tar.gz
CMake-4b95e7fe63d254b8e50f09f85a51e232a7470c7b.tar.bz2
CMAKE_ROLE: Fix value in --build for Visual Studio generators
Fixes: #18990
-rw-r--r--Source/cmakemain.cxx2
-rw-r--r--Tests/RunCMake/CMakeRoleGlobalProperty/Project.cmake4
-rw-r--r--Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake3
3 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 890b74e..a83f7dc 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -498,7 +498,7 @@ static int do_build(int ac, char const* const* av)
return 1;
}
- cmake cm(cmake::RoleInternal, cmState::Unknown);
+ cmake cm(cmake::RoleInternal, cmState::Project);
cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) {
cmakemainMessageCallback(msg, title, &cm);
});
diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/Project.cmake b/Tests/RunCMake/CMakeRoleGlobalProperty/Project.cmake
index c0b6a48..22cad2b 100644
--- a/Tests/RunCMake/CMakeRoleGlobalProperty/Project.cmake
+++ b/Tests/RunCMake/CMakeRoleGlobalProperty/Project.cmake
@@ -1,4 +1,8 @@
get_property(role GLOBAL PROPERTY CMAKE_ROLE)
+
+file(WRITE "${CMAKE_BINARY_DIR}/test.cmake" "# a")
+include("${CMAKE_BINARY_DIR}/test.cmake")
+
if(NOT role STREQUAL "PROJECT")
message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"PROJECT\"")
endif()
diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake b/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake
index 3cbd51d..7b29c28 100644
--- a/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake
@@ -2,6 +2,9 @@ include(RunCMake)
include(RunCTest)
run_cmake(Project)
+file(WRITE "${RunCMake_BINARY_DIR}/Project-build/test.cmake" "# b")
+run_cmake_command(ProjectBuild "${CMAKE_COMMAND}" --build "${RunCMake_BINARY_DIR}/Project-build")
+
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)