- BuildInfo &binfo;
-
- void cflag(const std::string &s) { binfo.cflags.push_back(s); }
- void incpath(const std::string &s) { binfo.incpath.push_back(s); }
- void define(const std::string &s) { binfo.defines.push_back(s); }
- void ldflag(const std::string &s) { binfo.ldflags.push_back(s); }
- void libpath(const std::string &s) { binfo.libpath.push_back(s); }
- void library(const std::string &s) { binfo.libs.push_back(s); }
+ void incpath(const std::string &);
+ void define(const std::string &, const std::string &);
+ void libpath(const std::string &);
+ void library(const std::string &);
+ };
+
+ enum UpdateLevel
+ {
+ LOCAL, //< Include all information
+ DEPENDENCY, //< Include all but code generation options
+ CHAINED //< Include only compilation options
+ };
+
+ /**
+ A wrapper which tracks the set status of the wrapped variable. A default
+ value may be provided in initialization without causing it to be treated as
+ set. Assigning from a raw value flags the Tracked object as set. Assigning
+ from another Tracked object will only change the value of the target if the
+ source is set.
+ */
+ template<typename T>
+ class Tracked
+ {
+ public:
+ typedef T LoadType;
+
+ private:
+ T value;
+ bool set;
+
+ public:
+ Tracked(): value(T()), set(false) { }
+ Tracked(T v): value(v), set(false) { }
+ Tracked &operator=(const Tracked &v) { if(v.set) { value = v.value; set = true; } return *this; }
+
+ Tracked &operator=(T v) { value = v; set = true; return *this; }
+ operator T() const { return value; }