summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-11-15 13:55:11 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-11-15 13:55:19 (GMT)
commit6f9544736a78f830b5852308f79c973f46773e22 (patch)
treeae5344f713de29254cdfaa55ec74462a1099bbb9 /Source
parent5dbc7be0da055536c0b7946cad6999829469e3dc (diff)
parent01611f825840553fecdc98edaa128dd8f6ce9801 (diff)
downloadCMake-6f9544736a78f830b5852308f79c973f46773e22.zip
CMake-6f9544736a78f830b5852308f79c973f46773e22.tar.gz
CMake-6f9544736a78f830b5852308f79c973f46773e22.tar.bz2
Merge topic 'better_handling_of_build_args'
01611f8258 cmake: --build improve detection of no build dir Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7908
Diffstat (limited to 'Source')
-rw-r--r--Source/cmakemain.cxx26
1 files changed, 7 insertions, 19 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 43bebc1..9f23667 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -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) {