cmake: Correct regression in -B <dir> <src_dir>

Fixes: #23285
This commit is contained in:
Robert Maynard
2022-03-01 16:37:37 -05:00
committed by Brad King
parent 4091d5c58c
commit 78e8f11456
2 changed files with 2 additions and 1 deletions

View File

@@ -1556,7 +1556,7 @@ bool cmake::SetDirectoriesFromFile(const std::string& arg)
// This function is called multiple times with the same path
if (is_source_dir) {
this->SetHomeDirectoryViaCommandLine(listPath, HomeDirArgStyle::Plain);
if (!no_build_tree) {
if (no_build_tree) {
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
this->SetHomeOutputDirectory(cwd);
}

View File

@@ -202,6 +202,7 @@ message(STATUS "CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}'")
run_cmake_with_options(ExplicitDirs-C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C initial-cache.txt)
# Test that full path works, too.
run_cmake_with_options(ExplicitDirs-C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt)
run_cmake_with_options(ExplicitDirs-C_buildsrcdir -B DummyBuildDir ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt)
endfunction()
run_ExplicitDirs()