summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetIncludeDirectoriesCommand.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/cmTargetIncludeDirectoriesCommand.cxx
parentdcc117b9446cfc3d6c8bf191545aac8d1519abca (diff)
downloadCMake-9d1a1bc495be41b035f61f9b707df8006da54160.zip
CMake-9d1a1bc495be41b035f61f9b707df8006da54160.tar.gz
CMake-9d1a1bc495be41b035f61f9b707df8006da54160.tar.bz2
cmTarget*: Port away from cmCommand
Diffstat (limited to 'Source/cmTargetIncludeDirectoriesCommand.cxx')
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx57
1 files changed, 39 insertions, 18 deletions
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index 7801ee8..95b69f3 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -11,26 +11,36 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmTargetPropCommandBase.h"
-class cmExecutionStatus;
+namespace {
-bool cmTargetIncludeDirectoriesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+class TargetIncludeDirectoriesImpl : public cmTargetPropCommandBase
{
- return this->HandleArguments(args, "INCLUDE_DIRECTORIES",
- ArgumentFlags(PROCESS_BEFORE | PROCESS_SYSTEM));
-}
+public:
+ using cmTargetPropCommandBase::cmTargetPropCommandBase;
-void cmTargetIncludeDirectoriesCommand::HandleMissingTarget(
- const std::string& name)
-{
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("Cannot specify include directories 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 include directories for target \"", name,
+ "\" which is not built by this project."));
+ }
+
+ bool HandleDirectContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) override;
+
+ void HandleInterfaceContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) override;
-std::string cmTargetIncludeDirectoriesCommand::Join(
+ std::string Join(const std::vector<std::string>& content) override;
+};
+
+std::string TargetIncludeDirectoriesImpl::Join(
const std::vector<std::string>& content)
{
std::string dirs;
@@ -48,7 +58,7 @@ std::string cmTargetIncludeDirectoriesCommand::Join(
return dirs;
}
-bool cmTargetIncludeDirectoriesCommand::HandleDirectContent(
+bool TargetIncludeDirectoriesImpl::HandleDirectContent(
cmTarget* tgt, const std::vector<std::string>& content, bool prepend,
bool system)
{
@@ -70,16 +80,27 @@ bool cmTargetIncludeDirectoriesCommand::HandleDirectContent(
return true; // Successfully handled.
}
-void cmTargetIncludeDirectoriesCommand::HandleInterfaceContent(
+void TargetIncludeDirectoriesImpl::HandleInterfaceContent(
cmTarget* tgt, const std::vector<std::string>& content, bool prepend,
bool system)
{
cmTargetPropCommandBase::HandleInterfaceContent(tgt, content, prepend,
system);
-
if (system) {
std::string joined = this->Join(content);
tgt->AppendProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
joined.c_str());
}
}
+
+} // namespace
+
+bool cmTargetIncludeDirectoriesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return TargetIncludeDirectoriesImpl(status).HandleArguments(
+ args, "INCLUDE_DIRECTORIES",
+ TargetIncludeDirectoriesImpl::ArgumentFlags(
+ TargetIncludeDirectoriesImpl::PROCESS_BEFORE |
+ TargetIncludeDirectoriesImpl::PROCESS_SYSTEM));
+}