summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-09-12 08:12:09 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-09-12 16:16:17 (GMT)
commite4c67981aca4fd736fd7503d9d105a0a6fb43828 (patch)
treeb15fbda6ad2c6497a4409ae78542d302ea6c22e3
parent36b939db682a9405790bee76f95673eeaeb445b8 (diff)
downloadCMake-e4c67981aca4fd736fd7503d9d105a0a6fb43828.zip
CMake-e4c67981aca4fd736fd7503d9d105a0a6fb43828.tar.gz
CMake-e4c67981aca4fd736fd7503d9d105a0a6fb43828.tar.bz2
cmGetSourceFilePropertyCommand: Port away from cmCommand
Ref: #19499
-rw-r--r--Source/cmCommands.cxx2
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx19
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h21
3 files changed, 12 insertions, 30 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 9ce4c14..ff19062 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -228,7 +228,7 @@ void GetProjectCommands(cmState* state)
state->AddBuiltinCommand("enable_language", cmEnableLanguageCommand);
state->AddBuiltinCommand("enable_testing", cmEnableTestingCommand);
state->AddBuiltinCommand("get_source_file_property",
- cm::make_unique<cmGetSourceFilePropertyCommand>());
+ cmGetSourceFilePropertyCommand);
state->AddBuiltinCommand("get_target_property",
cm::make_unique<cmGetTargetPropertyCommand>());
state->AddBuiltinCommand("get_test_property",
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 5c1c8a5..eefdc6c 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -2,26 +2,25 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetSourceFilePropertyCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-class cmExecutionStatus;
-
-// cmSetSourceFilePropertyCommand
-bool cmGetSourceFilePropertyCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() != 3) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
std::string const& var = args[0];
std::string const& file = args[1];
- cmSourceFile* sf = this->Makefile->GetSource(file);
+ cmMakefile& mf = status.GetMakefile();
+ cmSourceFile* sf = mf.GetSource(file);
// for the location we must create a source file first
if (!sf && args[2] == "LOCATION") {
- sf = this->Makefile->CreateSource(file);
+ sf = mf.CreateSource(file);
}
if (sf) {
const char* prop = nullptr;
@@ -29,11 +28,11 @@ bool cmGetSourceFilePropertyCommand::InitialPass(
prop = sf->GetPropertyForUser(args[2]);
}
if (prop) {
- this->Makefile->AddDefinition(var, prop);
+ mf.AddDefinition(var, prop);
return true;
}
}
- this->Makefile->AddDefinition(var, "NOTFOUND");
+ mf.AddDefinition(var, "NOTFOUND");
return true;
}
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 387a7f4..f0c319b 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -8,26 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmGetSourceFilePropertyCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmGetSourceFilePropertyCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the input file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif