diff options
-rw-r--r-- | Source/cmGetSourceFilePropertyCommand.cxx | 28 | ||||
-rw-r--r-- | Source/cmGetSourceFilePropertyCommand.h | 9 |
2 files changed, 14 insertions, 23 deletions
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index bfd7743..435d937 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -17,8 +17,8 @@ #include "cmGetSourceFilePropertyCommand.h" // cmSetSourceFilePropertyCommand -bool cmGetSourceFilePropertyCommand::InitialPass(std::vector<std::string> const& - args) +bool cmGetSourceFilePropertyCommand::InitialPass( + std::vector<std::string> const& args) { if(args.size() != 3 ) { @@ -28,28 +28,18 @@ bool cmGetSourceFilePropertyCommand::InitialPass(std::vector<std::string> const& const char* var = args[0].c_str(); const char* file = args[1].c_str(); cmSourceFile* sf = m_Makefile->GetSource(file); + if(sf) { - if(args[2] == "ABSTRACT") - { - m_Makefile->AddDefinition(var, sf->GetPropertyAsBool("ABSTRACT")); - } - if(args[2] == "WRAP_EXCLUDE") - { - m_Makefile->AddDefinition(var, sf->GetPropertyAsBool("WRAP_EXCLUDE")); - } - if(args[2] == "COMPILE_FLAGS") + const char *prop = sf->GetProperty(args[2].c_str()); + if (prop) { - m_Makefile->AddDefinition(var, sf->GetProperty("COMPILE_FLAGS")); + m_Makefile->AddDefinition(var, prop); + return true; } } - else - { - std::string m = "Could not find source file: "; - m += file; - this->SetError(m.c_str()); - return false; - } + + m_Makefile->AddDefinition(var, "NOT_FOUND"); return true; } diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 456f5ea..8d2e693 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -44,7 +44,7 @@ public: */ virtual const char* GetTerseDocumentation() { - return "Set attributes for a specific list of files."; + return "Get a property for a file"; } /** @@ -53,9 +53,10 @@ public: virtual const char* GetFullDocumentation() { return - "GET_SOURCE_FILE_PROPERTY(VAR file [ABSTRACT|WRAP_EXCLUDE|COMPILE_FLAGS]) " - "Get a property from a source file. The value of the property is stored " - "in the variable VAR."; + "GET_SOURCE_FILE_PROPERTY(VAR file property) " + "Get a property from a source file. The value of the property is " + " stored in the variable VAR. If the property is not found, var " + "will be set to NOT_FOUND"; } cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand); |