[cmake-commits] alex committed cmTarget.cxx 1.137.2.2 1.137.2.3
cmTarget.h 1.82.2.2 1.82.2.3
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu May 10 13:03:52 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv6366
Modified Files:
Tag: CMake-ImportTargets
cmTarget.cxx cmTarget.h
Log Message:
ENH: return the default location for imported targets if the
config-dependent locations are not set
Alex
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.82.2.2
retrieving revision 1.82.2.3
diff -u -d -r1.82.2.2 -r1.82.2.3
--- cmTarget.h 10 May 2007 15:41:49 -0000 1.82.2.2
+++ cmTarget.h 10 May 2007 17:03:50 -0000 1.82.2.3
@@ -331,12 +331,7 @@
void GetFullNameInternal(TargetType type, const char* config, bool implib,
std::string& outPrefix, std::string& outBase,
std::string& outSuffix);
- void NormalGetFullNameInternal(TargetType type, const char* config, bool implib,
- std::string& outPrefix, std::string& outBase,
- std::string& outSuffix);
- void ImportedGetFullNameInternal(TargetType type, const char* config, bool implib,
- std::string& outPrefix, std::string& outBase,
- std::string& outSuffix);
+
void GetLibraryNamesInternal(std::string& name,
std::string& soName,
std::string& realName,
@@ -361,6 +356,15 @@
const char* ImportedGetLocation(const char* config);
const char* NormalGetLocation(const char* config);
+ void NormalGetFullNameInternal(TargetType type, const char* config, bool implib,
+ std::string& outPrefix, std::string& outBase,
+ std::string& outSuffix);
+ void ImportedGetFullNameInternal(TargetType type, const char* config, bool implib,
+ std::string& outPrefix, std::string& outBase,
+ std::string& outSuffix);
+
+ const char* ImportedGetDirectory(const char* config, bool implib);
+ const char* NormalGetDirectory(const char* config, bool implib);
private:
std::string Name;
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.137.2.2
retrieving revision 1.137.2.3
diff -u -d -r1.137.2.2 -r1.137.2.3
--- cmTarget.cxx 10 May 2007 15:41:49 -0000 1.137.2.2
+++ cmTarget.cxx 10 May 2007 17:03:50 -0000 1.137.2.3
@@ -1223,6 +1223,25 @@
const char* cmTarget::GetDirectory(const char* config, bool implib)
{
+ if (this->IsImported())
+ {
+ return this->ImportedGetDirectory(config, implib);
+ }
+ else
+ {
+ return this->NormalGetDirectory(config, implib);
+ }
+}
+
+const char* cmTarget::ImportedGetDirectory(const char* config, bool implib)
+{
+ const char* location=this->GetLocation(config);
+ std::string directory=cmSystemTools::GetFilenamePath(location);
+ return directory.c_str();
+}
+
+const char* cmTarget::NormalGetDirectory(const char* config, bool implib)
+{
if(config)
{
this->Directory = this->GetOutputDir(implib);
@@ -1240,28 +1259,29 @@
const char* cmTarget::GetLocation(const char* config)
{
if (this->IsImported())
- {
+ {
return this->ImportedGetLocation(config);
- }
+ }
else
- {
+ {
return this->NormalGetLocation(config);
- }
+ }
}
const char* cmTarget::ImportedGetLocation(const char* config)
{
- std::string propertyName;
if ((config) && (strlen(config)))
{
- propertyName=config;
+ std::string propertyName=config;
propertyName+="_LOCATION";
+ const char* configLocation=this->GetProperty(propertyName.c_str());
+ if ((configLocation) && (strlen(configLocation)))
+ {
+ return configLocation;
+ }
}
- else
- {
- propertyName="LOCATION";
- }
- return this->GetProperty(propertyName.c_str());
+
+ return this->GetProperty("LOCATION");
}
const char* cmTarget::NormalGetLocation(const char* config)
@@ -1311,6 +1331,11 @@
void cmTarget::ComputeObjectFiles()
{
+ if (this->IsImported())
+ {
+ return;
+ }
+
// Force the SourceFiles vector to be populated
this->GenerateSourceFilesFromSourceLists(*this->Makefile);
std::vector<std::string> dirs;
More information about the Cmake-commits
mailing list