diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2014-11-05 20:37:52 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-11-14 16:55:09 (GMT) |
commit | fe5d6e8c0f2e37bac0621a3b976d95c471891f38 (patch) | |
tree | 56d2a66bbf625ed8f3274baf3632aab2337dd6f1 /Source/cmAddCustomTargetCommand.cxx | |
parent | ad6ee426278ebaa9518af4573362a96b0544f4f7 (diff) | |
download | CMake-fe5d6e8c0f2e37bac0621a3b976d95c471891f38.zip CMake-fe5d6e8c0f2e37bac0621a3b976d95c471891f38.tar.gz CMake-fe5d6e8c0f2e37bac0621a3b976d95c471891f38.tar.bz2 |
Add USES_TERMINAL option for custom commands
Teach the add_custom_command and add_custom_target commands a new
USES_TERMINAL option. Use it to tell the generator to give the command
direct access to the terminal if possible.
Diffstat (limited to 'Source/cmAddCustomTargetCommand.cxx')
-rw-r--r-- | Source/cmAddCustomTargetCommand.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 64e76f3..fc4f8f1 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; @@ -221,12 +227,20 @@ bool cmAddCustomTargetCommand cmSystemTools::CollapseFullPath(working_directory, build_dir); } + if (commandLines.empty() && uses_terminal) + { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "USES_TERMINAL may not be specified without any COMMAND"); + return true; + } + // Add the utility target to the makefile. bool escapeOldStyle = !verbatim; 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); |