summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetCompileFeaturesCommand.cxx
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-09-10 19:41:44 (GMT)
committerBrad King <brad.king@kitware.com>2019-09-26 17:27:55 (GMT)
commit9d1a1bc495be41b035f61f9b707df8006da54160 (patch)
treea1b41bb5a94b7ca5c8fdae2a1258581c59a62eb6 /Source/cmTargetCompileFeaturesCommand.cxx
parentdcc117b9446cfc3d6c8bf191545aac8d1519abca (diff)
downloadCMake-9d1a1bc495be41b035f61f9b707df8006da54160.zip
CMake-9d1a1bc495be41b035f61f9b707df8006da54160.tar.gz
CMake-9d1a1bc495be41b035f61f9b707df8006da54160.tar.bz2
cmTarget*: Port away from cmCommand
Diffstat (limited to 'Source/cmTargetCompileFeaturesCommand.cxx')
-rw-r--r--Source/cmTargetCompileFeaturesCommand.cxx65
1 files changed, 38 insertions, 27 deletions
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index a22b94b..06be4f0 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -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, ";");
-}
+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."));
+ }
-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.
+ 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, ";");
}
- return true; // Successfully handled.
+};
+
+} // namespace
+
+bool cmTargetCompileFeaturesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return TargetCompileFeaturesImpl(status).HandleArguments(args,
+ "COMPILE_FEATURES");
}