mirror of
https://github.com/reactos/CMake.git
synced 2025-02-14 16:38:42 +00:00
parent
36b939db68
commit
e4c67981ac
@ -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",
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user