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"
6 #include "cmMakefile.h"
7 #include "cmMessageType.h"
8 #include "cmStandardLevelResolver.h"
9 #include "cmStringAlgorithms.h"
10 #include "cmTargetPropCommandBase.h"
16 class TargetCompileFeaturesImpl
: public cmTargetPropCommandBase
19 using cmTargetPropCommandBase::cmTargetPropCommandBase
;
22 void HandleMissingTarget(const std::string
& name
) override
24 this->Makefile
->IssueMessage(
25 MessageType::FATAL_ERROR
,
26 cmStrCat("Cannot specify compile features for target \"", name
,
27 "\" which is not built by this project."));
30 bool HandleDirectContent(cmTarget
* tgt
,
31 const std::vector
<std::string
>& content
,
32 bool /*prepend*/, bool /*system*/) override
34 cmStandardLevelResolver
standardResolver(this->Makefile
);
35 for (std::string
const& it
: content
) {
37 if (!standardResolver
.AddRequiredTargetFeature(tgt
, it
, &error
)) {
38 this->SetError(error
);
39 return false; // Not (successfully) handled.
42 return true; // Successfully handled.
45 std::string
Join(const std::vector
<std::string
>& content
) override
47 return cmList::to_string(content
);
53 bool cmTargetCompileFeaturesCommand(std::vector
<std::string
> const& args
,
54 cmExecutionStatus
& status
)
56 return TargetCompileFeaturesImpl(status
).HandleArguments(args
,