mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
@@ -522,25 +522,8 @@ int do_build(int ac, char const* const* av)
|
||||
if (ac >= 3) {
|
||||
std::vector<std::string> inputArgs;
|
||||
|
||||
bool hasPreset = false;
|
||||
for (int i = 2; i < ac; ++i) {
|
||||
if (strcmp(av[i], "--list-presets") == 0 ||
|
||||
cmHasLiteralPrefix(av[i], "--preset=") ||
|
||||
strcmp(av[i], "--preset") == 0) {
|
||||
hasPreset = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPreset) {
|
||||
inputArgs.reserve(ac - 2);
|
||||
cm::append(inputArgs, av + 2, av + ac);
|
||||
} else {
|
||||
dir = cmSystemTools::CollapseFullPath(av[2]);
|
||||
|
||||
inputArgs.reserve(ac - 3);
|
||||
cm::append(inputArgs, av + 3, av + ac);
|
||||
}
|
||||
inputArgs.reserve(ac - 2);
|
||||
cm::append(inputArgs, av + 2, av + ac);
|
||||
|
||||
decltype(inputArgs.size()) i = 0;
|
||||
for (; i < inputArgs.size() && !nativeOptionsPassed; ++i) {
|
||||
@@ -555,6 +538,11 @@ int do_build(int ac, char const* const* av)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!matched && i == 0) {
|
||||
dir = cmSystemTools::CollapseFullPath(arg);
|
||||
matched = true;
|
||||
parsed = true;
|
||||
}
|
||||
if (!(matched && parsed)) {
|
||||
dir.clear();
|
||||
if (!matched) {
|
||||
|
||||
@@ -58,6 +58,8 @@ run_cmake_command(P_fresh ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_fresh.cm
|
||||
|
||||
run_cmake_command(build-no-dir
|
||||
${CMAKE_COMMAND} --build)
|
||||
run_cmake_command(build-no-dir2
|
||||
${CMAKE_COMMAND} --build --target=invalid)
|
||||
run_cmake_command(build-no-cache
|
||||
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR})
|
||||
run_cmake_command(build-unknown-command-short
|
||||
|
||||
1
Tests/RunCMake/CommandLine/build-no-dir2-result.txt
Normal file
1
Tests/RunCMake/CommandLine/build-no-dir2-result.txt
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
1
Tests/RunCMake/CommandLine/build-no-dir2-stderr.txt
Normal file
1
Tests/RunCMake/CommandLine/build-no-dir2-stderr.txt
Normal file
@@ -0,0 +1 @@
|
||||
^Usage: cmake --build <dir> +\[options\] \[-- \[native-options\]\]
|
||||
Reference in New Issue
Block a user