mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-03 04:40:18 -05:00
cmTarget*: Port away from cmCommand
This commit is contained in:
committed by
Brad King
parent
dcc117b944
commit
9d1a1bc495
@@ -5,40 +5,51 @@
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmTargetPropCommandBase.h"
|
||||
|
||||
class cmExecutionStatus;
|
||||
class cmTarget;
|
||||
|
||||
bool cmTargetCompileFeaturesCommand::InitialPass(
|
||||
std::vector<std::string> const& args, cmExecutionStatus&)
|
||||
{
|
||||
return this->HandleArguments(args, "COMPILE_FEATURES", NO_FLAGS);
|
||||
}
|
||||
namespace {
|
||||
|
||||
void cmTargetCompileFeaturesCommand::HandleMissingTarget(
|
||||
const std::string& name)
|
||||
class TargetCompileFeaturesImpl : public cmTargetPropCommandBase
|
||||
{
|
||||
this->Makefile->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("Cannot specify compile features for target \"", name,
|
||||
"\" which is not built by this project."));
|
||||
}
|
||||
public:
|
||||
using cmTargetPropCommandBase::cmTargetPropCommandBase;
|
||||
|
||||
std::string cmTargetCompileFeaturesCommand::Join(
|
||||
const std::vector<std::string>& content)
|
||||
{
|
||||
return cmJoin(content, ";");
|
||||
}
|
||||
|
||||
bool cmTargetCompileFeaturesCommand::HandleDirectContent(
|
||||
cmTarget* tgt, const std::vector<std::string>& content, bool, bool)
|
||||
{
|
||||
for (std::string const& it : content) {
|
||||
std::string error;
|
||||
if (!this->Makefile->AddRequiredTargetFeature(tgt, it, &error)) {
|
||||
this->SetError(error);
|
||||
return false; // Not (successfully) handled.
|
||||
}
|
||||
private:
|
||||
void HandleMissingTarget(const std::string& name) override
|
||||
{
|
||||
this->Makefile->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("Cannot specify compile features for target \"", name,
|
||||
"\" which is not built by this project."));
|
||||
}
|
||||
return true; // Successfully handled.
|
||||
|
||||
bool HandleDirectContent(cmTarget* tgt,
|
||||
const std::vector<std::string>& content,
|
||||
bool /*prepend*/, bool /*system*/) override
|
||||
{
|
||||
for (std::string const& it : content) {
|
||||
std::string error;
|
||||
if (!this->Makefile->AddRequiredTargetFeature(tgt, it, &error)) {
|
||||
this->SetError(error);
|
||||
return false; // Not (successfully) handled.
|
||||
}
|
||||
}
|
||||
return true; // Successfully handled.
|
||||
}
|
||||
|
||||
std::string Join(const std::vector<std::string>& content) override
|
||||
{
|
||||
return cmJoin(content, ";");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
bool cmTargetCompileFeaturesCommand(std::vector<std::string> const& args,
|
||||
cmExecutionStatus& status)
|
||||
{
|
||||
return TargetCompileFeaturesImpl(status).HandleArguments(args,
|
||||
"COMPILE_FEATURES");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user