summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetSourcesCommand.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/cmTargetSourcesCommand.cxx
parentdcc117b9446cfc3d6c8bf191545aac8d1519abca (diff)
downloadCMake-9d1a1bc495be41b035f61f9b707df8006da54160.zip
CMake-9d1a1bc495be41b035f61f9b707df8006da54160.tar.gz
CMake-9d1a1bc495be41b035f61f9b707df8006da54160.tar.bz2
cmTarget*: Port away from cmCommand
Diffstat (limited to 'Source/cmTargetSourcesCommand.cxx')
-rw-r--r--Source/cmTargetSourcesCommand.cxx81
1 files changed, 48 insertions, 33 deletions
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index 7c9d03c..c2e0b28 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -11,47 +11,54 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmTargetPropCommandBase.h"
-class cmExecutionStatus;
+namespace {
-bool cmTargetSourcesCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+class TargetSourcesImpl : public cmTargetPropCommandBase
{
- return this->HandleArguments(args, "SOURCES");
-}
+public:
+ using cmTargetPropCommandBase::cmTargetPropCommandBase;
-void cmTargetSourcesCommand::HandleInterfaceContent(
- cmTarget* tgt, const std::vector<std::string>& content, bool prepend,
- bool system)
-{
- cmTargetPropCommandBase::HandleInterfaceContent(
- tgt, ConvertToAbsoluteContent(tgt, content, true), prepend, system);
-}
+protected:
+ void HandleInterfaceContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) override
+ {
+ cmTargetPropCommandBase::HandleInterfaceContent(
+ tgt, ConvertToAbsoluteContent(tgt, content, true), prepend, system);
+ }
-void cmTargetSourcesCommand::HandleMissingTarget(const std::string& name)
-{
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("Cannot specify sources for target \"", name,
- "\" which is not built by this project."));
-}
+private:
+ void HandleMissingTarget(const std::string& name) override
+ {
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Cannot specify sources for target \"", name,
+ "\" which is not built by this project."));
+ }
-std::string cmTargetSourcesCommand::Join(
- const std::vector<std::string>& content)
-{
- return cmJoin(content, ";");
-}
+ bool HandleDirectContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool /*prepend*/, bool /*system*/) override
+ {
+ tgt->AppendProperty(
+ "SOURCES",
+ this->Join(ConvertToAbsoluteContent(tgt, content, false)).c_str());
+ return true; // Successfully handled.
+ }
-bool cmTargetSourcesCommand::HandleDirectContent(
- cmTarget* tgt, const std::vector<std::string>& content, bool, bool)
-{
- tgt->AppendProperty(
- "SOURCES",
- this->Join(ConvertToAbsoluteContent(tgt, content, false)).c_str());
- return true; // Successfully handled.
-}
+ std::string Join(const std::vector<std::string>& content) override
+ {
+ return cmJoin(content, ";");
+ }
+
+ std::vector<std::string> ConvertToAbsoluteContent(
+ cmTarget* tgt, const std::vector<std::string>& content,
+ bool isInterfaceContent);
+};
-std::vector<std::string> cmTargetSourcesCommand::ConvertToAbsoluteContent(
+std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
cmTarget* tgt, const std::vector<std::string>& content,
bool isInterfaceContent)
{
@@ -120,3 +127,11 @@ std::vector<std::string> cmTargetSourcesCommand::ConvertToAbsoluteContent(
return useAbsoluteContent ? absoluteContent : content;
}
+
+} // namespace
+
+bool cmTargetSourcesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return TargetSourcesImpl(status).HandleArguments(args, "SOURCES");
+}