1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #include "cmTargetCompileFeaturesCommand.h"
5 #include "cmMakefile.h"
6 #include "cmMessageType.h"
7 #include "cmStandardLevelResolver.h"
8 #include "cmStringAlgorithms.h"
9 #include "cmTargetPropCommandBase.h"
15 class TargetCompileFeaturesImpl : public cmTargetPropCommandBase
18 using cmTargetPropCommandBase::cmTargetPropCommandBase;
21 void HandleMissingTarget(const std::string& name) override
23 this->Makefile->IssueMessage(
24 MessageType::FATAL_ERROR,
25 cmStrCat("Cannot specify compile features for target \"", name,
26 "\" which is not built by this project."));
29 bool HandleDirectContent(cmTarget* tgt,
30 const std::vector<std::string>& content,
31 bool /*prepend*/, bool /*system*/) override
33 cmStandardLevelResolver standardResolver(this->Makefile);
34 for (std::string const& it : content) {
36 if (!standardResolver.AddRequiredTargetFeature(tgt, it, &error)) {
37 this->SetError(error);
38 return false; // Not (successfully) handled.
41 return true; // Successfully handled.
44 std::string Join(const std::vector<std::string>& content) override
46 return cmJoin(content, ";");
52 bool cmTargetCompileFeaturesCommand(std::vector<std::string> const& args,
53 cmExecutionStatus& status)
55 return TargetCompileFeaturesImpl(status).HandleArguments(args,