diff options
Diffstat (limited to 'Source/cmAddCustomTargetCommand.cxx')
-rw-r--r-- | Source/cmAddCustomTargetCommand.cxx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 9c41dac..0d01493 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -2,8 +2,18 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmAddCustomTargetCommand.h" +#include <sstream> + +#include "cmCustomCommandLines.h" #include "cmGeneratorExpression.h" #include "cmGlobalGenerator.h" +#include "cmMakefile.h" +#include "cmPolicies.h" +#include "cmSystemTools.h" +#include "cmTarget.h" +#include "cmake.h" + +class cmExecutionStatus; // cmAddCustomTargetCommand bool cmAddCustomTargetCommand::InitialPass( @@ -37,6 +47,7 @@ bool cmAddCustomTargetCommand::InitialPass( std::string working_directory; bool verbatim = false; bool uses_terminal = false; + bool command_expand_lists = false; std::string comment_buffer; const char* comment = CM_NULLPTR; std::vector<std::string> sources; @@ -80,6 +91,9 @@ bool cmAddCustomTargetCommand::InitialPass( } else if (copy == "USES_TERMINAL") { doing = doing_nothing; uses_terminal = true; + } else if (copy == "COMMAND_EXPAND_LISTS") { + doing = doing_nothing; + command_expand_lists = true; } else if (copy == "COMMENT") { doing = doing_comment; } else if (copy == "COMMAND") { @@ -144,7 +158,7 @@ bool cmAddCustomTargetCommand::InitialPass( bool nameOk = cmGeneratorExpression::IsValidTargetName(targetName) && !cmGlobalGenerator::IsReservedTarget(targetName); if (nameOk) { - nameOk = targetName.find(":") == std::string::npos; + nameOk = targetName.find(':') == std::string::npos; } if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; @@ -211,12 +225,19 @@ bool cmAddCustomTargetCommand::InitialPass( "USES_TERMINAL may not be specified without any COMMAND"); return true; } + if (commandLines.empty() && command_expand_lists) { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "COMMAND_EXPAND_LISTS 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(), byproducts, depends, - commandLines, escapeOldStyle, comment, uses_terminal); + commandLines, escapeOldStyle, comment, uses_terminal, + command_expand_lists); // Add additional user-specified source files to the target. target->AddSources(sources); |