]> git.tdb.fi Git - builder.git/blobdiff - source/sourcepackage.cpp
Properly support multiple choice features
[builder.git] / source / sourcepackage.cpp
index 515841dd2ee7f5257851c6af5d9ca00305d3a749..dbb759205fe0eef45f3b0b1ded50cfe5ba80a077 100644 (file)
@@ -103,8 +103,14 @@ void SourcePackage::do_prepare()
        build_info.libpath.push_back((builder.get_prefix()/"lib").str());
 
        for(FeatureList::iterator i=features.begin(); i!=features.end(); ++i)
-               if(lexical_cast<bool>(config.get_option("with_"+i->name).value))
-                       build_info.defines["WITH_"+toupper(i->name)] = "1";
+       {
+               string ident = "WITH_"+toupper(i->name);
+               string value = config.get_option("with_"+i->name).value;
+               if(!i->choices.empty())
+                       build_info.defines[ident] = value;
+               else if(lexical_cast<bool>(value))
+                       build_info.defines[ident] = "1";
+       }
 
        bool export_paths = false;
        for(list<Component>::iterator i=components.begin(); i!=components.end(); ++i)
@@ -189,7 +195,6 @@ void SourcePackage::Loader::feature(const string &n, const string &d)
 {
        Feature feat(n);
        feat.description = d;
-       feat.default_value = "no";
        load_sub(feat);
        obj.features.push_back(feat);