[Cmake-commits] [cmake-commits] king committed cmLocalGenerator.cxx 1.318 1.319 cmLocalGenerator.h 1.118 1.119 cmMakefile.cxx 1.523 1.524 cmMakefile.h 1.261 1.262 cmMakefileTargetGenerator.cxx 1.126 1.127 cmMakefileTargetGenerator.h 1.34 1.35 cmTarget.cxx 1.273 1.274 cmTarget.h 1.143 1.144
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Oct 2 13:52:03 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv16116/Source
Modified Files:
cmLocalGenerator.cxx cmLocalGenerator.h cmMakefile.cxx
cmMakefile.h cmMakefileTargetGenerator.cxx
cmMakefileTargetGenerator.h cmTarget.cxx cmTarget.h
Log Message:
Introduce "build feature" lookup framework
This creates cmTarget::GetFeature and cmMakefile::GetFeature methods to
query "build feature" properties. These methods handle local-to-global
scope and per-configuration property lookup. Specific build features
will be defined later.
Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.318
retrieving revision 1.319
diff -C 2 -d -r1.318 -r1.319
*** cmLocalGenerator.cxx 30 Sep 2009 12:31:53 -0000 1.318
--- cmLocalGenerator.cxx 2 Oct 2009 17:52:00 -0000 1.319
***************
*** 2084,2087 ****
--- 2084,2107 ----
//----------------------------------------------------------------------------
+ void cmLocalGenerator::AppendFeatureOptions(
+ std::string& flags, const char* lang, const char* feature)
+ {
+ std::string optVar = "CMAKE_";
+ optVar += lang;
+ optVar += "_COMPILE_OPTIONS_";
+ optVar += feature;
+ if(const char* optionList = this->Makefile->GetDefinition(optVar.c_str()))
+ {
+ std::vector<std::string> options;
+ cmSystemTools::ExpandListArgument(optionList, options);
+ for(std::vector<std::string>::const_iterator oi = options.begin();
+ oi != options.end(); ++oi)
+ {
+ this->AppendFlags(flags, this->EscapeForShell(oi->c_str()).c_str());
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------------
std::string
cmLocalGenerator::ConstructComment(const cmCustomCommand& cc,
Index: cmLocalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v
retrieving revision 1.118
retrieving revision 1.119
diff -C 2 -d -r1.118 -r1.119
*** cmLocalGenerator.h 28 Sep 2009 15:42:47 -0000 1.118
--- cmLocalGenerator.h 2 Oct 2009 17:52:00 -0000 1.119
***************
*** 150,153 ****
--- 150,157 ----
const char* lang);
+ /** Lookup and append options associated with a particular feature. */
+ void AppendFeatureOptions(std::string& flags, const char* lang,
+ const char* feature);
+
/** Translate a dependency as given in CMake code to the name to
appear in a generated build file. If the given name is that of
Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.261
retrieving revision 1.262
diff -C 2 -d -r1.261 -r1.262
*** cmMakefile.h 30 Sep 2009 17:45:14 -0000 1.261
--- cmMakefile.h 2 Oct 2009 17:52:01 -0000 1.262
***************
*** 794,797 ****
--- 794,799 ----
bool GetPropertyAsBool(const char *prop);
+ const char* GetFeature(const char* feature, const char* config);
+
// Get the properties
cmPropertyMap &GetProperties() { return this->Properties; };
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.143
retrieving revision 1.144
diff -C 2 -d -r1.143 -r1.144
*** cmTarget.h 28 Sep 2009 15:42:49 -0000 1.143
--- cmTarget.h 2 Oct 2009 17:52:01 -0000 1.144
***************
*** 233,236 ****
--- 233,238 ----
void CheckProperty(const char* prop, cmMakefile* context);
+ const char* GetFeature(const char* feature, const char* config);
+
bool IsImported() const {return this->IsImportedTarget;}
Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.126
retrieving revision 1.127
diff -C 2 -d -r1.126 -r1.127
*** cmMakefileTargetGenerator.cxx 2 Oct 2009 17:51:49 -0000 1.126
--- cmMakefileTargetGenerator.cxx 2 Oct 2009 17:52:01 -0000 1.127
***************
*** 1763,1766 ****
--- 1763,1778 ----
//----------------------------------------------------------------------------
+ const char* cmMakefileTargetGenerator::GetFeature(const char* feature)
+ {
+ return this->Target->GetFeature(feature, this->ConfigName);
+ }
+
+ //----------------------------------------------------------------------------
+ bool cmMakefileTargetGenerator::GetFeatureAsBool(const char* feature)
+ {
+ return cmSystemTools::IsOn(this->GetFeature(feature));
+ }
+
+ //----------------------------------------------------------------------------
void cmMakefileTargetGenerator::AddFeatureFlags(
std::string& flags, const char* lang
Index: cmMakefileTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -C 2 -d -r1.34 -r1.35
*** cmMakefileTargetGenerator.h 2 Oct 2009 17:51:49 -0000 1.34
--- cmMakefileTargetGenerator.h 2 Oct 2009 17:52:01 -0000 1.35
***************
*** 224,227 ****
--- 224,231 ----
void AddFeatureFlags(std::string& flags, const char* lang);
+ // Feature query methods.
+ const char* GetFeature(const char* feature);
+ bool GetFeatureAsBool(const char* feature);
+
//==================================================================
// Convenience routines that do nothing more than forward to
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.273
retrieving revision 1.274
diff -C 2 -d -r1.273 -r1.274
*** cmTarget.cxx 28 Sep 2009 15:42:49 -0000 1.273
--- cmTarget.cxx 2 Oct 2009 17:52:01 -0000 1.274
***************
*** 2246,2249 ****
--- 2246,2269 ----
//----------------------------------------------------------------------------
+ const char* cmTarget::GetFeature(const char* feature, const char* config)
+ {
+ if(config && *config)
+ {
+ std::string featureConfig = feature;
+ featureConfig += "_";
+ featureConfig += cmSystemTools::UpperCase(config);
+ if(const char* value = this->GetProperty(featureConfig.c_str()))
+ {
+ return value;
+ }
+ }
+ if(const char* value = this->GetProperty(feature))
+ {
+ return value;
+ }
+ return this->Makefile->GetFeature(feature, config);
+ }
+
+ //----------------------------------------------------------------------------
const char *cmTarget::GetProperty(const char* prop)
{
Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.523
retrieving revision 1.524
diff -C 2 -d -r1.523 -r1.524
*** cmMakefile.cxx 30 Sep 2009 17:45:14 -0000 1.523
--- cmMakefile.cxx 2 Oct 2009 17:52:01 -0000 1.524
***************
*** 3312,3315 ****
--- 3312,3340 ----
}
+ //----------------------------------------------------------------------------
+ const char* cmMakefile::GetFeature(const char* feature, const char* config)
+ {
+ // TODO: Define accumulation policy for features (prepend, append, replace).
+ // Currently we always replace.
+ if(config && *config)
+ {
+ std::string featureConfig = feature;
+ featureConfig += "_";
+ featureConfig += cmSystemTools::UpperCase(config);
+ if(const char* value = this->GetProperty(featureConfig.c_str()))
+ {
+ return value;
+ }
+ }
+ if(const char* value = this->GetProperty(feature))
+ {
+ return value;
+ }
+ if(cmLocalGenerator* parent = this->LocalGenerator->GetParent())
+ {
+ return parent->GetMakefile()->GetFeature(feature, config);
+ }
+ return 0;
+ }
cmTarget* cmMakefile::FindTarget(const char* name)
More information about the Cmake-commits
mailing list