[Cmake-commits] CMake branch, next, updated. v3.5.0-rc1-39-gea89648
Brad King
brad.king at kitware.com
Fri Feb 5 11:49:21 EST 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via ea896482b563918c9d839577adab1ee926893bcd (commit)
via 497cad7c883dc401b4d78109c3a057fb38745d9e (commit)
via 886acd80f09c807fccbfcde713c53a7686386968 (commit)
from ee1a481cf097d78e547e4af821767b3347c443d8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea896482b563918c9d839577adab1ee926893bcd
commit ea896482b563918c9d839577adab1ee926893bcd
Merge: ee1a481 497cad7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 5 11:49:20 2016 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Feb 5 11:49:20 2016 -0500
Merge topic 'error-multiple-targets' into next
497cad7c cmake: Teach --build to reject multiple --target options
886acd80 Help: Fix reference to `cmake --build` in cmake(1) manual
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=497cad7c883dc401b4d78109c3a057fb38745d9e
commit 497cad7c883dc401b4d78109c3a057fb38745d9e
Author: Sebastian Schuberth <sschuberth at gmail.com>
AuthorDate: Thu Feb 4 12:36:44 2016 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 5 11:48:16 2016 -0500
cmake: Teach --build to reject multiple --target options
Previously we did not clearly document that `--target` is only supported
to be specified once. Even worse, specifying it multiple times would
silently ignore any previously specified targets and only build the last
target.
Update the documentation to specify this. Update the implementation to
reject multiple `--target` options to prevent user errors.
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 273a780..959148e 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -58,6 +58,7 @@ Options
<dir> = Project binary directory to be built.
--target <tgt> = Build <tgt> instead of default targets.
+ May only be specified once.
--config <cfg> = For multi-configuration tools, choose <cfg>.
--clean-first = Build target 'clean' first, then build.
(To clean only, use --target 'clean'.)
diff --git a/Help/release/dev/error-multiple-targets.rst b/Help/release/dev/error-multiple-targets.rst
new file mode 100644
index 0000000..060b26b
--- /dev/null
+++ b/Help/release/dev/error-multiple-targets.rst
@@ -0,0 +1,6 @@
+error-multiple-targets
+----------------------
+
+* The :manual:`cmake(1)` ``--build`` command-line tool now rejects multiple
+ ``--target`` options with an error instead of silently ignoring all but the
+ last one.
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)
{
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt
new file mode 100644
index 0000000..f2cbaa6
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt
@@ -0,0 +1,3 @@
+^'--target' may not be specified more than once\.
++
+Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
index 20df108..d2a2831 100644
--- a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
+++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
@@ -3,3 +3,5 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
)
add_custom_target(CustomTarget ALL DEPENDS output.txt)
+add_custom_target(CustomTarget2 ALL DEPENDS output.txt)
+add_custom_target(CustomTarget3 ALL DEPENDS output.txt)
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index e3b73ff..a07bbbe 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -51,6 +51,8 @@ function(run_BuildDir)
run_cmake(BuildDir)
run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir ..
${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget)
+ run_cmake_command(BuildDir--build-multiple-targets ${CMAKE_COMMAND} -E chdir ..
+ ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget2 --target CustomTarget3)
endfunction()
run_BuildDir()
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=886acd80f09c807fccbfcde713c53a7686386968
commit 886acd80f09c807fccbfcde713c53a7686386968
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 5 11:47:41 2016 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 5 11:48:16 2016 -0500
Help: Fix reference to `cmake --build` in cmake(1) manual
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 91af3e3..273a780 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -64,7 +64,7 @@ Options
--use-stderr = Ignored. Behavior is default in CMake >= 3.0.
-- = Pass remaining options to the native tool.
- Run cmake --build with no options for quick help.
+ Run ``cmake --build`` with no options for quick help.
``-N``
View mode only.
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake.1.rst | 3 ++-
Help/release/dev/error-multiple-targets.rst | 6 ++++++
Source/cmakemain.cxx | 14 +++++++++++++-
.../BuildDir--build-multiple-targets-result.txt} | 0
.../BuildDir--build-multiple-targets-stderr.txt | 3 +++
Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt | 2 ++
Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 2 ++
7 files changed, 28 insertions(+), 2 deletions(-)
create mode 100644 Help/release/dev/error-multiple-targets.rst
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CommandLine/BuildDir--build-multiple-targets-result.txt} (100%)
create mode 100644 Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list