[Cmake-commits] CMake branch, next, updated. v3.1.0-rc2-609-gb885491
Peter Collingbourne
peter at pcc.me.uk
Fri Nov 14 10:55:13 EST 2014
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 b885491276d2e121ccb72e815792ca142366b857 (commit)
via e544d90343811ef6d48a0e877bd8fc12181ed8df (commit)
via 9e15a769d0895dc665e8f28252a589a953c36901 (commit)
via 1114d9f305c64bee732bc38bfff945c1ba778150 (commit)
via 04d9a117c5e90b8cc2805e7ff29fd61a8437280c (commit)
via a00f4b6820996f47e365d253e7278e12df4542a6 (commit)
via 0fc2fc4fab75501e36ea12c78ae1a7723c1e2f3a (commit)
via 018f152358e7b27ee82b2b2ff1f4b7327b5f1542 (commit)
via 2a5dfeb05822f185c4daf69d6e0bd6686cbb6e3c (commit)
via 0700f2ef1918a4bf9de197e1b25f1e2a00eb82f5 (commit)
from 90848be9b04ddc898fc88d7c41bf16d49b57a1e5 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b885491276d2e121ccb72e815792ca142366b857
commit b885491276d2e121ccb72e815792ca142366b857
Merge: 90848be e544d90
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Fri Nov 14 10:55:11 2014 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Nov 14 10:55:11 2014 -0500
Merge topic 'console-pool' into next
e544d903 Merge topic 'doc-add_custom_target' into console-pool
9e15a769 Help: Add notes for topic 'console-pool'
1114d9f3 Ninja: Implement USES_TERMINAL using the console pool if available
04d9a117 Ninja: Remove unused declaration
a00f4b68 Ninja: factor out the test for console pool support
0fc2fc4f Give the interactive cache editor the USES_TERMINAL property
018f1523 Introduce USES_TERMINAL property for add_custom_{command,target}
2a5dfeb0 Rename doing_verbatim to doing_nothing
0700f2ef CMake Nightly Date Stamp
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e544d90343811ef6d48a0e877bd8fc12181ed8df
commit e544d90343811ef6d48a0e877bd8fc12181ed8df
Merge: 9e15a76 66ea634
Author: Peter Collingbourne <pcc at google.com>
AuthorDate: Fri Nov 14 15:53:31 2014 +0000
Commit: Peter Collingbourne <pcc at google.com>
CommitDate: Fri Nov 14 15:53:31 2014 +0000
Merge topic 'doc-add_custom_target' into console-pool
Conflicts:
Help/command/add_custom_target.rst
diff --cc Help/command/add_custom_target.rst
index 6e6c76a,4f8e190..81a94a1
--- a/Help/command/add_custom_target.rst
+++ b/Help/command/add_custom_target.rst
@@@ -13,37 -13,68 +13,73 @@@ Add a target with no output so it will
[SOURCES src1 [src2...]])
Adds a target with the given name that executes the given commands.
- The target has no output file and is ALWAYS CONSIDERED OUT OF DATE
+ The target has no output file and is *always considered out of date*
even if the commands try to create a file with the name of the target.
- Use ADD_CUSTOM_COMMAND to generate a file with dependencies. By
- default nothing depends on the custom target. Use ADD_DEPENDENCIES to
- add dependencies to or from other targets. If the ALL option is
- specified it indicates that this target should be added to the default
- build target so that it will be run every time (the command cannot be
- called ALL). The command and arguments are optional and if not
- specified an empty target will be created. If WORKING_DIRECTORY is
- set, then the command will be run in that directory. If it is a
- relative path it will be interpreted relative to the build tree
- directory corresponding to the current source directory. If COMMENT
- is set, the value will be displayed as a message before the commands
- are executed at build time. Dependencies listed with the DEPENDS
- argument may reference files and outputs of custom commands created
- with add_custom_command() in the same directory (CMakeLists.txt file).
-
- If VERBATIM is given then all arguments to the commands will be
- escaped properly for the build tool so that the invoked command
- receives each argument unchanged. Note that one level of escapes is
- still used by the CMake language processor before add_custom_target
- even sees the arguments. Use of VERBATIM is recommended as it enables
- correct behavior. When VERBATIM is not given the behavior is platform
- specific because there is no protection of tool-specific special
- characters.
-
- If USES_TERMINAL is given, the command will be given direct access to the
- terminal if possible. With the Ninja generator, this places the command in
- the ``console`` pool.
-
- The SOURCES option specifies additional source files to be included in
- the custom target. Specified source files will be added to IDE
- project files for convenience in editing even if they have not build
- rules.
+ Use the :command:`add_custom_command` command to generate a file with
+ dependencies. By default nothing depends on the custom target. Use
+ the :command:`add_dependencies` command to add dependencies to or
+ from other targets.
+
+ The options are:
+
+ ``ALL``
+ Indicate that this target should be added to the default build
+ target so that it will be run every time (the command cannot be
+ called ``ALL``).
+
+ ``COMMAND``
+ Specify the command-line(s) to execute at build time.
+ If more than one ``COMMAND`` is specified they will be executed in order,
+ but *not* necessarily composed into a stateful shell or batch script.
+ (To run a full script, use the :command:`configure_file` command or the
+ :command:`file(GENERATE)` command to create it, and then specify
+ a ``COMMAND`` to launch it.)
+
+ If ``COMMAND`` specifies an executable target (created by the
+ :command:`add_executable` command) it will automatically be replaced
+ by the location of the executable created at build time.
+ Additionally a target-level dependency will be added so that the
+ executable target will be built before this custom target.
+
+ Arguments to ``COMMAND`` may use
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+ References to target names in generator expressions imply target-level
+ dependencies.
+
+ The command and arguments are optional and if not specified an empty
+ target will be created.
+
+ ``COMMENT``
+ Display the given message before the commands are executed at
+ build time.
+
+ ``DEPENDS``
+ Reference files and outputs of custom commands created with
+ :command:`add_custom_command` command calls in the same directory
+ (``CMakeLists.txt`` file). They will be brought up to date when
+ the target is built.
+
+ ``SOURCES``
+ Specify additional source files to be included in the custom target.
+ Specified source files will be added to IDE project files for
+ convenience in editing even if they have no build rules.
+
+ ``VERBATIM``
+ All arguments to the commands will be escaped properly for the
+ build tool so that the invoked command receives each argument
+ unchanged. Note that one level of escapes is still used by the
+ CMake language processor before ``add_custom_target`` even sees
+ the arguments. Use of ``VERBATIM`` is recommended as it enables
+ correct behavior. When ``VERBATIM`` is not given the behavior
+ is platform specific because there is no protection of
+ tool-specific special characters.
+
++``USES_TERMINAL``
++ The command will be given direct access to the terminal if possible.
++ With the Ninja generator, this places the command in the ``console``
++ pool.
++
+ ``WORKING_DIRECTORY``
+ Execute the command with the given current working directory.
+ If it is a relative path it will be interpreted relative to the
+ build tree directory corresponding to the current source directory.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e15a769d0895dc665e8f28252a589a953c36901
commit 9e15a769d0895dc665e8f28252a589a953c36901
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Wed Nov 5 22:04:30 2014 +0100
Commit: Peter Collingbourne <pcc at google.com>
CommitDate: Fri Nov 14 15:37:40 2014 +0000
Help: Add notes for topic 'console-pool'
diff --git a/Help/release/dev/console-pool.rst b/Help/release/dev/console-pool.rst
new file mode 100644
index 0000000..df34f2e
--- /dev/null
+++ b/Help/release/dev/console-pool.rst
@@ -0,0 +1,7 @@
+console-pool
+------------
+
+* A USES_TERMINAL flag has been added to the add_custom_command and
+ add_custom_target commands. The flag gives the command direct access to
+ the terminal if possible. With the Ninja generator, it places the command
+ in the console pool.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1114d9f305c64bee732bc38bfff945c1ba778150
commit 1114d9f305c64bee732bc38bfff945c1ba778150
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Wed Nov 5 21:42:18 2014 +0100
Commit: Peter Collingbourne <pcc at google.com>
CommitDate: Fri Nov 14 15:37:40 2014 +0000
Ninja: Implement USES_TERMINAL using the console pool if available
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 688eca4..60ab3e4 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -250,6 +250,7 @@ void
cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
const std::string& description,
const std::string& comment,
+ bool uses_terminal,
const cmNinjaDeps& outputs,
const cmNinjaDeps& deps,
const cmNinjaDeps& orderOnly)
@@ -266,6 +267,10 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
cmNinjaVars vars;
vars["COMMAND"] = cmd;
vars["DESC"] = EncodeLiteral(description);
+ if (uses_terminal && SupportsConsolePool())
+ {
+ vars["pool"] = "console";
+ }
this->WriteBuild(*this->BuildFileStream,
comment,
@@ -826,6 +831,7 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
std::copy(i->second.begin(), i->second.end(), std::back_inserter(deps));
WriteCustomCommandBuild(/*command=*/"", /*description=*/"",
"Assume dependencies for generated source file.",
+ /*uses_terminal*/false,
cmNinjaDeps(1, i->first), deps);
}
}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 38b5ef5..a166938 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -103,6 +103,7 @@ public:
void WriteCustomCommandBuild(const std::string& command,
const std::string& description,
const std::string& comment,
+ bool uses_terminal,
const cmNinjaDeps& outputs,
const cmNinjaDeps& deps = cmNinjaDeps(),
const cmNinjaDeps& orderOnly = cmNinjaDeps());
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 9225f64..3c39b62 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -468,6 +468,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
this->BuildCommandLine(cmdLines),
this->ConstructComment(ccg),
"Custom command for " + ninjaOutputs[0],
+ cc->GetUsesTerminal(),
ninjaOutputs,
ninjaDeps,
orderOnlyDeps);
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index f5d18dc..c0a14ec 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -35,6 +35,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
&this->GetTarget()->GetPostBuildCommands()
};
+ bool uses_terminal = false;
+
for (unsigned i = 0; i != 2; ++i) {
for (std::vector<cmCustomCommand>::const_iterator
ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) {
@@ -42,6 +44,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
this->GetMakefile());
this->GetLocalGenerator()->AppendCustomCommandDeps(ccg, deps);
this->GetLocalGenerator()->AppendCustomCommandLines(ccg, commands);
+ if (ci->GetUsesTerminal())
+ uses_terminal = true;
}
}
@@ -110,6 +114,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
command,
desc,
"Utility command for " + this->GetTargetName(),
+ uses_terminal,
cmNinjaDeps(1, utilCommandName),
deps);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=04d9a117c5e90b8cc2805e7ff29fd61a8437280c
commit 04d9a117c5e90b8cc2805e7ff29fd61a8437280c
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Wed Nov 5 21:40:43 2014 +0100
Commit: Peter Collingbourne <pcc at google.com>
CommitDate: Fri Nov 14 15:37:39 2014 +0000
Ninja: Remove unused declaration
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 40a15a3..17cf517 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -116,7 +116,6 @@ protected:
void WriteObjectBuildStatements();
void WriteObjectBuildStatement(cmSourceFile const* source,
bool writeOrderDependsTargetForTarget);
- void WriteCustomCommandBuildStatement(cmCustomCommand *cc);
cmNinjaDeps GetObjects() const
{ return this->Objects; }
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a00f4b6820996f47e365d253e7278e12df4542a6
commit a00f4b6820996f47e365d253e7278e12df4542a6
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Wed Nov 5 21:40:14 2014 +0100
Commit: Peter Collingbourne <pcc at google.com>
CommitDate: Fri Nov 14 15:37:39 2014 +0000
Ninja: factor out the test for console pool support
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 498ae9a..688eca4 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1141,9 +1141,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmNinjaVars variables;
// Use 'console' pool to get non buffered output of the CMake re-run call
// Available since Ninja 1.5
- if(cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
- ninjaVersion().c_str(),
- "1.5") == false)
+ if(SupportsConsolePool())
{
variables["pool"] = "console";
}
@@ -1185,6 +1183,12 @@ std::string cmGlobalNinjaGenerator::ninjaVersion() const
return version;
}
+bool cmGlobalNinjaGenerator::SupportsConsolePool() const
+{
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
+ ninjaVersion().c_str(), "1.5") == false;
+}
+
void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
{
WriteRule(*this->RulesFileStream,
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index f666ee3..38b5ef5 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -299,6 +299,9 @@ public:
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
std::string ninjaVersion() const;
+
+ bool SupportsConsolePool() const;
+
protected:
/// Overloaded methods. @see cmGlobalGenerator::Generate()
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0fc2fc4fab75501e36ea12c78ae1a7723c1e2f3a
commit 0fc2fc4fab75501e36ea12c78ae1a7723c1e2f3a
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Wed Nov 5 21:39:32 2014 +0100
Commit: Peter Collingbourne <pcc at google.com>
CommitDate: Fri Nov 14 15:37:39 2014 +0000
Give the interactive cache editor the USES_TERMINAL property
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ab9dc88..8826930 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2207,7 +2207,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
= this->CreateGlobalTarget(this->GetPackageTargetName(),
"Run CPack packaging tool...",
&cpackCommandLines, depends,
- workingDir.c_str());
+ workingDir.c_str(), /*uses_terminal*/false);
}
// CPack source
const char* packageSourceTargetName = this->GetPackageSourceTargetName();
@@ -2231,8 +2231,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
= this->CreateGlobalTarget(packageSourceTargetName,
"Run CPack packaging tool for source...",
&cpackCommandLines, depends,
- workingDir.c_str()
- );
+ workingDir.c_str(), /*uses_terminal*/false);
}
}
@@ -2257,7 +2256,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.push_back(singleLine);
(*targets)[this->GetTestTargetName()]
= this->CreateGlobalTarget(this->GetTestTargetName(),
- "Running tests...", &cpackCommandLines, depends, 0);
+ "Running tests...", &cpackCommandLines, depends, 0,
+ /*uses_terminal*/false);
}
//Edit Cache
@@ -2280,7 +2280,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[editCacheTargetName] =
this->CreateGlobalTarget(
editCacheTargetName, "Running CMake cache editor...",
- &cpackCommandLines, depends, 0);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/true);
}
else
{
@@ -2293,7 +2293,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
this->CreateGlobalTarget(
editCacheTargetName,
"No interactive CMake dialog available...",
- &cpackCommandLines, depends, 0);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/false);
}
}
@@ -2312,7 +2312,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[rebuildCacheTargetName] =
this->CreateGlobalTarget(
rebuildCacheTargetName, "Running CMake to regenerate build system...",
- &cpackCommandLines, depends, 0);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/false);
}
//Install
@@ -2352,7 +2352,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)["list_install_components"]
= this->CreateGlobalTarget("list_install_components",
ostr.str().c_str(),
- &cpackCommandLines, depends, 0);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/false);
}
std::string cmd = cmakeCommand;
cpackCommandLines.erase(cpackCommandLines.begin(),
@@ -2392,7 +2392,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[this->GetInstallTargetName()] =
this->CreateGlobalTarget(
this->GetInstallTargetName(), "Install the project...",
- &cpackCommandLines, depends, 0);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/false);
// install_local
if(const char* install_local = this->GetInstallLocalTargetName())
@@ -2408,7 +2408,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[install_local] =
this->CreateGlobalTarget(
install_local, "Installing only the local directory...",
- &cpackCommandLines, depends, 0);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/false);
}
// install_strip
@@ -2425,7 +2425,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[install_strip] =
this->CreateGlobalTarget(
install_strip, "Installing the project stripped...",
- &cpackCommandLines, depends, 0);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/false);
}
}
}
@@ -2499,7 +2499,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
const std::string& name, const char* message,
const cmCustomCommandLines* commandLines,
std::vector<std::string> depends,
- const char* workingDirectory)
+ const char* workingDirectory,
+ bool uses_terminal)
{
// Package
cmTarget target;
@@ -2512,6 +2513,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
// Store the custom command in the target.
cmCustomCommand cc(0, no_outputs, no_depends, *commandLines, 0,
workingDirectory);
+ cc.SetUsesTerminal(uses_terminal);
target.AddPostBuildCommand(cc);
target.SetProperty("EchoString", message);
std::vector<std::string>::iterator dit;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 8a10d38..926efe7 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -385,7 +385,8 @@ protected:
void CreateDefaultGlobalTargets(cmTargets* targets);
cmTarget CreateGlobalTarget(const std::string& name, const char* message,
const cmCustomCommandLines* commandLines,
- std::vector<std::string> depends, const char* workingDir);
+ std::vector<std::string> depends, const char* workingDir,
+ bool uses_terminal);
bool NeedSymbolicMark;
bool UseLinkScript;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=018f152358e7b27ee82b2b2ff1f4b7327b5f1542
commit 018f152358e7b27ee82b2b2ff1f4b7327b5f1542
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Wed Nov 5 21:37:52 2014 +0100
Commit: Peter Collingbourne <pcc at google.com>
CommitDate: Fri Nov 14 15:37:39 2014 +0000
Introduce USES_TERMINAL property for add_custom_{command,target}
This property tells the generator to give the command direct access to the
terminal if possible.
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index e8b7cc8..cf0be5c 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -18,7 +18,7 @@ The first signature is for adding a custom command to produce an output::
[IMPLICIT_DEPENDS <lang1> depend1
[<lang2> depend2] ...]
[WORKING_DIRECTORY dir]
- [COMMENT comment] [VERBATIM] [APPEND])
+ [COMMENT comment] [VERBATIM] [APPEND] [USES_TERMINAL])
This defines a command to generate specified ``OUTPUT`` file(s).
A target created in the same directory (``CMakeLists.txt`` file)
@@ -118,6 +118,11 @@ The options are:
as a file on disk it should be marked with the :prop_sf:`SYMBOLIC`
source file property.
+``USES_TERMINAL``
+ The command will be given direct access to the terminal if possible.
+ With the Ninja generator, this places the command in the ``console``
+ pool.
+
``VERBATIM``
All arguments to the commands will be escaped properly for the
build tool so that the invoked command receives each argument
diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst
index 1bf70bf..6e6c76a 100644
--- a/Help/command/add_custom_target.rst
+++ b/Help/command/add_custom_target.rst
@@ -9,7 +9,7 @@ Add a target with no output so it will always be built.
[COMMAND command2 [args2...] ...]
[DEPENDS depend depend depend ... ]
[WORKING_DIRECTORY dir]
- [COMMENT comment] [VERBATIM]
+ [COMMENT comment] [VERBATIM] [USES_TERMINAL]
[SOURCES src1 [src2...]])
Adds a target with the given name that executes the given commands.
@@ -39,6 +39,10 @@ correct behavior. When VERBATIM is not given the behavior is platform
specific because there is no protection of tool-specific special
characters.
+If USES_TERMINAL is given, the command will be given direct access to the
+terminal if possible. With the Ninja generator, this places the command in
+the ``console`` pool.
+
The SOURCES option specifies additional source files to be included in
the custom target. Specified source files will be added to IDE
project files for convenience in editing even if they have not build
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 2d19610..94cfb31 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -35,6 +35,7 @@ bool cmAddCustomCommandCommand
std::vector<std::string> depends, outputs, output;
bool verbatim = false;
bool append = false;
+ bool uses_terminal = false;
std::string implicit_depends_lang;
cmCustomCommand::ImplicitDependsList implicit_depends;
@@ -102,6 +103,10 @@ bool cmAddCustomCommandCommand
{
append = true;
}
+ else if(copy == "USES_TERMINAL")
+ {
+ uses_terminal = true;
+ }
else if(copy == "TARGET")
{
doing = doing_target;
@@ -312,7 +317,7 @@ bool cmAddCustomCommandCommand
this->Makefile->AddCustomCommandToTarget(target, no_depends,
commandLines, cctype,
comment, working.c_str(),
- escapeOldStyle);
+ escapeOldStyle, uses_terminal);
}
else if(target.empty())
{
@@ -321,7 +326,7 @@ bool cmAddCustomCommandCommand
main_dependency,
commandLines, comment,
working.c_str(), false,
- escapeOldStyle);
+ escapeOldStyle, uses_terminal);
// Add implicit dependency scanning requests if any were given.
if(!implicit_depends.empty())
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 64e76f3..3025719 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -48,6 +48,7 @@ bool cmAddCustomTargetCommand
std::vector<std::string> depends;
std::string working_directory;
bool verbatim = false;
+ bool uses_terminal = false;
std::string comment_buffer;
const char* comment = 0;
std::vector<std::string> sources;
@@ -93,6 +94,11 @@ bool cmAddCustomTargetCommand
doing = doing_nothing;
verbatim = true;
}
+ else if(copy == "USES_TERMINAL")
+ {
+ doing = doing_nothing;
+ uses_terminal = true;
+ }
else if (copy == "COMMENT")
{
doing = doing_comment;
@@ -226,7 +232,8 @@ bool cmAddCustomTargetCommand
cmTarget* target =
this->Makefile->AddUtilityCommand(targetName, excludeFromAll,
working_directory.c_str(), depends,
- commandLines, escapeOldStyle, comment);
+ commandLines, escapeOldStyle, comment,
+ uses_terminal);
// Add additional user-specified source files to the target.
target->AddSources(sources);
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index c161eb6..ad1c11b 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -34,7 +34,8 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
WorkingDirectory(r.WorkingDirectory),
EscapeAllowMakeVars(r.EscapeAllowMakeVars),
EscapeOldStyle(r.EscapeOldStyle),
- Backtrace(r.Backtrace)
+ Backtrace(r.Backtrace),
+ UsesTerminal(r.UsesTerminal)
{
}
@@ -56,6 +57,7 @@ cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r)
this->EscapeOldStyle = r.EscapeOldStyle;
this->ImplicitDepends = r.ImplicitDepends;
this->Backtrace = r.Backtrace;
+ this->UsesTerminal = r.UsesTerminal;
return *this;
}
@@ -184,3 +186,15 @@ void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList const& l)
this->ImplicitDepends.insert(this->ImplicitDepends.end(),
l.begin(), l.end());
}
+
+//----------------------------------------------------------------------------
+bool cmCustomCommand::GetUsesTerminal() const
+{
+ return this->UsesTerminal;
+}
+
+//----------------------------------------------------------------------------
+void cmCustomCommand::SetUsesTerminal(bool b)
+{
+ this->UsesTerminal = b;
+}
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index 21dbefb..283a0e4 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -79,6 +79,11 @@ public:
void AppendImplicitDepends(ImplicitDependsList const&);
ImplicitDependsList const& GetImplicitDepends() const;
+ /** Set/Get whether this custom command should be given access to the
+ real console (if possible). */
+ bool GetUsesTerminal() const;
+ void SetUsesTerminal(bool b);
+
private:
std::vector<std::string> Outputs;
std::vector<std::string> Depends;
@@ -90,6 +95,7 @@ private:
bool EscapeOldStyle;
cmListFileBacktrace Backtrace;
ImplicitDependsList ImplicitDepends;
+ bool UsesTerminal;
};
#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 8a8aadc..7e5e4e7 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -885,7 +885,8 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
cmTarget::CustomCommandType type,
const char* comment,
const char* workingDir,
- bool escapeOldStyle) const
+ bool escapeOldStyle,
+ bool uses_terminal) const
{
// Find the target to which to add the custom command.
cmTargets::iterator ti = this->Targets.find(target);
@@ -941,6 +942,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
commandLines, comment, workingDir);
cc.SetEscapeOldStyle(escapeOldStyle);
cc.SetEscapeAllowMakeVars(true);
+ cc.SetUsesTerminal(uses_terminal);
switch(type)
{
case cmTarget::PRE_BUILD:
@@ -964,7 +966,8 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
const char* comment,
const char* workingDir,
bool replace,
- bool escapeOldStyle)
+ bool escapeOldStyle,
+ bool uses_terminal)
{
// Make sure there is at least one output.
if(outputs.empty())
@@ -1071,6 +1074,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
comment, workingDir);
cc->SetEscapeOldStyle(escapeOldStyle);
cc->SetEscapeAllowMakeVars(true);
+ cc->SetUsesTerminal(uses_terminal);
file->SetCustomCommand(cc);
this->UpdateOutputToSourceMap(outputs, file);
}
@@ -1119,13 +1123,15 @@ cmMakefile::AddCustomCommandToOutput(const std::string& output,
const char* comment,
const char* workingDir,
bool replace,
- bool escapeOldStyle)
+ bool escapeOldStyle,
+ bool uses_terminal)
{
std::vector<std::string> outputs;
outputs.push_back(output);
return this->AddCustomCommandToOutput(outputs, depends, main_dependency,
commandLines, comment, workingDir,
- replace, escapeOldStyle);
+ replace, escapeOldStyle,
+ uses_terminal);
}
//----------------------------------------------------------------------------
@@ -1242,7 +1248,8 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName,
const char* workingDirectory,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
- bool escapeOldStyle, const char* comment)
+ bool escapeOldStyle, const char* comment,
+ bool uses_terminal)
{
// Create a target instance for this utility.
cmTarget* target = this->AddNewTarget(cmTarget::UTILITY, utilityName);
@@ -1269,7 +1276,7 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName,
no_main_dependency,
commandLines, comment,
workingDirectory, no_replace,
- escapeOldStyle);
+ escapeOldStyle, uses_terminal);
cmSourceFile* sf = target->AddSourceCMP0049(force);
// The output is not actually created so mark it symbolic.
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 824513b..73c299e 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -174,7 +174,8 @@ public:
const cmCustomCommandLines& commandLines,
cmTarget::CustomCommandType type,
const char* comment, const char* workingDir,
- bool escapeOldStyle = true) const;
+ bool escapeOldStyle = true,
+ bool uses_terminal = false) const;
cmSourceFile* AddCustomCommandToOutput(
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
@@ -182,7 +183,8 @@ public:
const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDir,
bool replace = false,
- bool escapeOldStyle = true);
+ bool escapeOldStyle = true,
+ bool uses_terminal = false);
cmSourceFile* AddCustomCommandToOutput(
const std::string& output,
const std::vector<std::string>& depends,
@@ -190,7 +192,8 @@ public:
const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDir,
bool replace = false,
- bool escapeOldStyle = true);
+ bool escapeOldStyle = true,
+ bool uses_terminal = false);
void AddCustomCommandOldStyle(const std::string& target,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
@@ -237,7 +240,8 @@ public:
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
bool escapeOldStyle = true,
- const char* comment = 0);
+ const char* comment = 0,
+ bool uses_terminal = false);
/**
* Add a link library to the build.
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index b97cd16..e260070 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -483,3 +483,26 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}")
add_library(NormDepends "${gen_file}")
+
+# Test that USES_TERMINAL is parsed correctly.
+# It seems much more difficult to test that USES_TERMINAL actually gives
+# the subprocess console access, as test output is piped through CTest,
+# and CTest itself might not be connected to the console.
+
+set(gen_file "${gen_path}/bar2.cxx")
+
+add_custom_command(
+ OUTPUT "${gen_file}"
+ DEPENDS "${gen_path}"
+ COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}"
+ VERBATIM
+ USES_TERMINAL
+)
+
+add_library(UseConsole "${gen_file}")
+
+add_custom_target(UseConsoleTarget ALL
+ COMMAND ${CMAKE_COMMAND} -E echo "Custom console target."
+ VERBATIM
+ USES_TERMINAL
+)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2a5dfeb05822f185c4daf69d6e0bd6686cbb6e3c
commit 2a5dfeb05822f185c4daf69d6e0bd6686cbb6e3c
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Wed Nov 5 21:38:19 2014 +0100
Commit: Peter Collingbourne <pcc at google.com>
CommitDate: Fri Nov 14 15:11:32 2014 +0000
Rename doing_verbatim to doing_nothing
We are about to introduce another property here, so give this
a better name.
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 3235502..64e76f3 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -59,7 +59,7 @@ bool cmAddCustomTargetCommand
doing_working_directory,
doing_comment,
doing_source,
- doing_verbatim
+ doing_nothing
};
tdoing doing = doing_command;
@@ -90,7 +90,7 @@ bool cmAddCustomTargetCommand
}
else if(copy == "VERBATIM")
{
- doing = doing_verbatim;
+ doing = doing_nothing;
verbatim = true;
}
else if (copy == "COMMENT")
-----------------------------------------------------------------------
Summary of changes:
Help/command/add_custom_command.rst | 7 ++++++-
Help/command/add_custom_target.rst | 7 ++++++-
Help/release/dev/console-pool.rst | 7 +++++++
Source/CMakeVersion.cmake | 2 +-
Source/cmAddCustomCommandCommand.cxx | 9 +++++++--
Source/cmAddCustomTargetCommand.cxx | 13 ++++++++++---
Source/cmCustomCommand.cxx | 16 +++++++++++++++-
Source/cmCustomCommand.h | 6 ++++++
Source/cmGlobalGenerator.cxx | 26 ++++++++++++++------------
Source/cmGlobalGenerator.h | 3 ++-
Source/cmGlobalNinjaGenerator.cxx | 16 +++++++++++++---
Source/cmGlobalNinjaGenerator.h | 4 ++++
Source/cmLocalNinjaGenerator.cxx | 1 +
Source/cmMakefile.cxx | 19 +++++++++++++------
Source/cmMakefile.h | 12 ++++++++----
Source/cmNinjaTargetGenerator.h | 1 -
Source/cmNinjaUtilityTargetGenerator.cxx | 5 +++++
Tests/CustomCommand/CMakeLists.txt | 23 +++++++++++++++++++++++
18 files changed, 141 insertions(+), 36 deletions(-)
create mode 100644 Help/release/dev/console-pool.rst
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list