diff options
author | Brad King <brad.king@kitware.com> | 2016-02-08 15:32:55 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-02-08 15:32:55 (GMT) |
commit | 08e53620044c1ac5ff29adb695a7c6bdde480fb4 (patch) | |
tree | da88cc17846ac711b1ac4d7a2b84804c808c63e1 /Source | |
parent | 037738ac194a7e50c92ffda60eaca707bb35bac9 (diff) | |
parent | 497cad7c883dc401b4d78109c3a057fb38745d9e (diff) | |
download | CMake-08e53620044c1ac5ff29adb695a7c6bdde480fb4.zip CMake-08e53620044c1ac5ff29adb695a7c6bdde480fb4.tar.gz CMake-08e53620044c1ac5ff29adb695a7c6bdde480fb4.tar.bz2 |
Merge topic 'error-multiple-targets'
497cad7c cmake: Teach --build to reject multiple --target options
886acd80 Help: Fix reference to `cmake --build` in cmake(1) manual
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmakemain.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index a06b26f..c60b962 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -60,6 +60,7 @@ static const char * cmDocumentationUsageNote[][2] = #define CMAKE_BUILD_OPTIONS \ " <dir> = Project binary directory to be built.\n" \ " --target <tgt> = Build <tgt> instead of default targets.\n" \ + " May only be specified once.\n" \ " --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \ " --clean-first = Build target 'clean' first, then build.\n" \ " (To clean only, use --target 'clean'.)\n" \ @@ -386,6 +387,7 @@ static int do_build(int ac, char const* const* av) std::string dir; std::vector<std::string> nativeOptions; bool clean = false; + bool hasTarget = false; enum Doing { DoingNone, DoingDir, DoingTarget, DoingConfig, DoingNative}; Doing doing = DoingDir; @@ -397,7 +399,17 @@ static int do_build(int ac, char const* const* av) } else if(strcmp(av[i], "--target") == 0) { - doing = DoingTarget; + if (!hasTarget) + { + doing = DoingTarget; + hasTarget = true; + } + else + { + std::cerr << "'--target' may not be specified more than once.\n\n"; + dir = ""; + break; + } } else if(strcmp(av[i], "--config") == 0) { |