Commit 4b95e7fe authored by Kyle Edwards's avatar Kyle Edwards
Browse files

CMAKE_ROLE: Fix value in --build for Visual Studio generators

Fixes: #18990
parent 8455e166
...@@ -498,7 +498,7 @@ static int do_build(int ac, char const* const* av) ...@@ -498,7 +498,7 @@ static int do_build(int ac, char const* const* av)
return 1; return 1;
} }
cmake cm(cmake::RoleInternal, cmState::Unknown); cmake cm(cmake::RoleInternal, cmState::Project);
cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) { cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) {
cmakemainMessageCallback(msg, title, &cm); cmakemainMessageCallback(msg, title, &cm);
}); });
......
get_property(role GLOBAL PROPERTY CMAKE_ROLE) 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") if(NOT role STREQUAL "PROJECT")
message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"PROJECT\"") message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"PROJECT\"")
endif() endif()
......
...@@ -2,6 +2,9 @@ include(RunCMake) ...@@ -2,6 +2,9 @@ include(RunCMake)
include(RunCTest) include(RunCTest)
run_cmake(Project) 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(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_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_ctest(CTest)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment