Browse Source

Allow option value to be expanded (thus, we can use the value of another option as default)

Sebastien Barre 24 years ago
parent
commit
edc738173b
1 changed files with 4 additions and 3 deletions
  1. 4 3
      Source/cmOptionCommand.cxx

+ 4 - 3
Source/cmOptionCommand.cxx

@@ -55,13 +55,14 @@ bool cmOptionCommand::InitialPass(std::vector<std::string>& args)
     = m_Makefile->GetDefinition(args[0].c_str());
     = m_Makefile->GetDefinition(args[0].c_str());
   if(!cacheValue)
   if(!cacheValue)
     {
     {
-    const char* initialValue = "Off";
+    std::string initialValue = "Off";
     if(args.size() == 3)
     if(args.size() == 3)
       {
       {
-      initialValue = args[2].c_str();
+      initialValue = args[2];
+      m_Makefile->ExpandVariablesInString(initialValue);
       }
       }
     m_Makefile->AddCacheDefinition(args[0].c_str(),
     m_Makefile->AddCacheDefinition(args[0].c_str(),
-                                   cmSystemTools::IsOn(initialValue),
+                                   cmSystemTools::IsOn(initialValue.c_str()),
                                    args[1].c_str());
                                    args[1].c_str());
     }
     }
   else
   else