summaryrefslogtreecommitdiffstats
path: root/Source/cmOptionCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-09-11 14:03:59 (GMT)
committerBrad King <brad.king@kitware.com>2009-09-11 14:03:59 (GMT)
commit7a409fd573721ae4346bee682d80fb285ab98497 (patch)
tree501e87de0e88920cd70c49211b4dc5760f85bfdb /Source/cmOptionCommand.cxx
parentb41a548d86f8989e790f0150abd3eb337e8c03d0 (diff)
downloadCMake-7a409fd573721ae4346bee682d80fb285ab98497.zip
CMake-7a409fd573721ae4346bee682d80fb285ab98497.tar.gz
CMake-7a409fd573721ae4346bee682d80fb285ab98497.tar.bz2
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'.
Diffstat (limited to 'Source/cmOptionCommand.cxx')
-rw-r--r--Source/cmOptionCommand.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index 5bd66a5..b4e57a1 100644
--- a/Source/cmOptionCommand.cxx
+++ b/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;
}