Browse Source

updated to match the SET

Ken Martin 23 years ago
parent
commit
b8be208408
2 changed files with 14 additions and 23 deletions
  1. 9 19
      Source/cmGetSourceFilePropertyCommand.cxx
  2. 5 4
      Source/cmGetSourceFilePropertyCommand.h

+ 9 - 19
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;
 }
 

+ 5 - 4
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);