diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmAuxSourceDirectoryCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmCPluginAPI.cxx | 2 | ||||
-rw-r--r-- | Source/cmCreateTestSourceList.cxx | 5 | ||||
-rw-r--r-- | Source/cmFLTKWrapUICommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 7 | ||||
-rw-r--r-- | Source/cmPropertyMap.cxx | 2 | ||||
-rw-r--r-- | Source/cmSourceFile.cxx | 22 | ||||
-rw-r--r-- | Source/cmSourceFile.h | 9 |
8 files changed, 40 insertions, 13 deletions
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 1c0388d..2cc5789 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -69,8 +69,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass // add the file as a class file so // depends can be done cmSourceFile cmfile; - cmfile.GetProperties().SetCMakeInstance - (this->Makefile->GetCMakeInstance()); + cmfile.SetMakefile(this->Makefile); cmfile.SetName(fullname.c_str(), this->Makefile->GetCurrentDirectory(), this->Makefile->GetSourceExtensions(), diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 2510382..26e8275 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -511,7 +511,7 @@ void * CCONV cmCreateNewSourceFile(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); cmSourceFile *sf = new cmSourceFile; - sf->GetProperties().SetCMakeInstance(mf->GetCMakeInstance()); + sf->SetMakefile(mf); return (void *)sf; } diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 89253e9..ebd7f71 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -172,7 +172,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) // Create the source list cmSourceFile cfile; - cfile.GetProperties().SetCMakeInstance(this->Makefile->GetCMakeInstance()); + cfile.SetMakefile(this->Makefile); std::string sourceListValue; cfile.SetProperty("ABSTRACT","0"); @@ -186,8 +186,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) for(i = testsBegin; i != tests.end(); ++i) { cmSourceFile icfile; - icfile.GetProperties(). - SetCMakeInstance(this->Makefile->GetCMakeInstance()); + icfile.SetMakefile(this->Makefile); icfile.SetProperty("ABSTRACT","0"); icfile.SetName(i->c_str(), this->Makefile->GetCurrentDirectory(), diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index d9457ba..d3d6f28 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -54,8 +54,7 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args) if (!curr || !curr->GetPropertyAsBool("WRAP_EXCLUDE")) { cmSourceFile header_file; - header_file.GetProperties().SetCMakeInstance - (this->Makefile->GetCMakeInstance()); + header_file.SetMakefile(this->Makefile); std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*i); const bool headerFileOnly = true; header_file.SetName(srcName.c_str(), diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4054bdf..eb16809 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2281,7 +2281,7 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName, // we must create one cmSourceFile file; - file.GetProperties().SetCMakeInstance(this->GetCMakeInstance()); + file.SetMakefile(this); std::string path = cmSystemTools::GetFilenamePath(src); if(generated) { @@ -2329,12 +2329,15 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName, this->AddSource(file); src = file.GetFullPath(); ret = this->GetSource(src.c_str()); - ret->GetProperties().SetCMakeInstance(this->GetCMakeInstance()); if (!ret) { cmSystemTools::Error( "CMake failed to properly look up cmSourceFile: ", sourceName); } + else + { + ret->SetMakefile(this); + } return ret; } diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index 9c68824..7c5608f 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -19,7 +19,7 @@ #include "cmake.h" // define STRICT to get checking of all set and get property calls -//#define STRICT +#define STRICT cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name) { diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 52148b2..4fc74e8 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -18,6 +18,7 @@ #include "cmSystemTools.h" #include "cmake.h" +#include "cmMakefile.h" // Set the name of the class and the full path to the file. // The class must be found in dir and end in name.cxx, name.txx, @@ -193,8 +194,14 @@ const char *cmSourceFile::GetProperty(const char* prop) const } bool chain = false; - return this->Properties.GetPropertyValue(prop,cmProperty::SOURCE_FILE, - chain); + const char *retVal = + this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain); + if (chain) + { + return this->Makefile->GetProperty(prop,cmProperty::SOURCE_FILE); + } + + return retVal; } bool cmSourceFile::GetPropertyAsBool(const char* prop) const @@ -223,9 +230,20 @@ const std::string& cmSourceFile::GetSourceNameWithoutLastExtension() cmSourceFile::cmSourceFile() { + this->Makefile = 0; this->CustomCommand = 0; } +//---------------------------------------------------------------------------- +void cmSourceFile::SetMakefile(cmMakefile* mf) +{ + // Set our makefile. + this->Makefile = mf; + + // set the cmake instance of the properties + this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); +} + // define properties void cmSourceFile::DefineProperties(cmake *cm) { diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 0b636ef..7f00483 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -21,6 +21,7 @@ #include "cmPropertyMap.h" class cmake; +class cmMakefile; /** \class cmSourceFile * \brief Represent a class loaded from a makefile. @@ -114,6 +115,10 @@ public: // Define the properties static void DefineProperties(cmake *cm); + ///! Set the cmMakefile that owns this target + void SetMakefile(cmMakefile *mf); + cmMakefile *GetMakefile() { return this->Makefile;}; + private: cmPropertyMap Properties; cmCustomCommand *CustomCommand; @@ -122,6 +127,10 @@ private: std::string SourceExtension; std::vector<std::string> Depends; std::string SourceNameWithoutLastExtension; + + // The cmMakefile instance that owns this source file. This should + // always be set. + cmMakefile* Makefile; }; #endif |