Browse Source

Fix option() interpretation of non-boolean values

The commit "Remove barely-used cmMakefile::AddCacheDefinition" broke
option() calls that pass a non-boolean default value.  We restore the
old behavior by always coercing the value to 'ON' or 'OFF'.
Brad King 16 năm trước cách đây
mục cha
commit
7a409fd573
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      Source/cmOptionCommand.cxx

+ 2 - 1
Source/cmOptionCommand.cxx

@@ -70,7 +70,8 @@ bool cmOptionCommand
     {
     initialValue = args[2];
     }
-  this->Makefile->AddCacheDefinition(args[0].c_str(), initialValue.c_str(),
+  bool init = cmSystemTools::IsOn(initialValue.c_str());
+  this->Makefile->AddCacheDefinition(args[0].c_str(), init? "ON":"OFF",
                                      args[1].c_str(), cmCacheManager::BOOL);
   return true;
 }