diff options
author | Rosen Matev <r.matev@gmail.com> | 2019-05-10 12:37:39 (GMT) |
---|---|---|
committer | Rosen Matev <r.matev@gmail.com> | 2019-05-14 13:58:00 (GMT) |
commit | 9f76961de87d8911d13867d469c38087e47a0b60 (patch) | |
tree | 13cf78b16bcbf13e6a4aef6b6963c38137083b21 /Source/cmAddCustomTargetCommand.cxx | |
parent | 5a2023f904c5da80a4614c133b7d7d8f4f719e96 (diff) | |
download | CMake-9f76961de87d8911d13867d469c38087e47a0b60.zip CMake-9f76961de87d8911d13867d469c38087e47a0b60.tar.gz CMake-9f76961de87d8911d13867d469c38087e47a0b60.tar.bz2 |
Support job pools in custom commands and targets
Provide a way for custom commands and targets to set the pool variable
of the ninja build statement. Setting `JOB_POOL` is not compatible with
`USES_TERMINAL`, which implies the `console` pool.
The option is silently ignored with other generators.
Closes: #18483
Diffstat (limited to 'Source/cmAddCustomTargetCommand.cxx')
-rw-r--r-- | Source/cmAddCustomTargetCommand.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 8240d3e..0ecd5f5 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -52,6 +52,7 @@ bool cmAddCustomTargetCommand::InitialPass( std::string comment_buffer; const char* comment = nullptr; std::vector<std::string> sources; + std::string job_pool; // Keep track of parser state. enum tdoing @@ -62,6 +63,7 @@ bool cmAddCustomTargetCommand::InitialPass( doing_working_directory, doing_comment, doing_source, + doing_job_pool, doing_nothing }; tdoing doing = doing_command; @@ -97,6 +99,8 @@ bool cmAddCustomTargetCommand::InitialPass( command_expand_lists = true; } else if (copy == "COMMENT") { doing = doing_comment; + } else if (copy == "JOB_POOL") { + doing = doing_job_pool; } else if (copy == "COMMAND") { doing = doing_command; @@ -137,6 +141,9 @@ bool cmAddCustomTargetCommand::InitialPass( case doing_source: sources.push_back(copy); break; + case doing_job_pool: + job_pool = copy; + break; default: this->SetError("Wrong syntax. Unknown type of argument."); return false; @@ -200,12 +207,17 @@ bool cmAddCustomTargetCommand::InitialPass( return true; } + if (uses_terminal && !job_pool.empty()) { + this->SetError("JOB_POOL is shadowed by USES_TERMINAL."); + return false; + } + // Add the utility target to the makefile. bool escapeOldStyle = !verbatim; cmTarget* target = this->Makefile->AddUtilityCommand( targetName, cmMakefile::TargetOrigin::Project, excludeFromAll, working_directory.c_str(), byproducts, depends, commandLines, - escapeOldStyle, comment, uses_terminal, command_expand_lists); + escapeOldStyle, comment, uses_terminal, command_expand_lists, job_pool); // Add additional user-specified source files to the target. target->AddSources(sources); |