[cmake-commits] alex committed cmInstallTargetGenerator.cxx 1.36 1.37
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Jun 15 14:27:36 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv17920
Modified Files:
cmInstallTargetGenerator.cxx
Log Message:
STYLE: remove code duplication between PrepareScriptReference and
GetScriptReference, and make the logic for getting the filename public, so
it can be used e.g. for exporting
Alex
Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- cmInstallTargetGenerator.cxx 15 Jun 2007 17:00:54 -0000 1.36
+++ cmInstallTargetGenerator.cxx 15 Jun 2007 18:27:33 -0000 1.37
@@ -189,6 +189,63 @@
}
//----------------------------------------------------------------------------
+std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
+ const char* config,
+ bool implib,
+ bool useSOName)
+{
+ std::string fname;
+ // Compute the name of the library.
+ if(target->GetType() == cmTarget::EXECUTABLE)
+ {
+ std::string targetName;
+ std::string targetNameReal;
+ std::string targetNameImport;
+ std::string targetNamePDB;
+ target->GetExecutableNames(targetName, targetNameReal,
+ targetNameImport, targetNamePDB,
+ config);
+ if(implib)
+ {
+ // Use the import library name.
+ fname = targetNameImport;
+ }
+ else
+ {
+ // Use the canonical name.
+ fname = targetName;
+ }
+ }
+ else
+ {
+ std::string targetName;
+ std::string targetNameSO;
+ std::string targetNameReal;
+ std::string targetNameImport;
+ std::string targetNamePDB;
+ target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
+ targetNameImport, targetNamePDB, config);
+ if(implib)
+ {
+ // Use the import library name.
+ fname = targetNameImport;
+ }
+ else if(useSOName)
+ {
+ // Use the soname.
+ fname = targetNameSO;
+ }
+ else
+ {
+ // Use the canonical name.
+ fname = targetName;
+ }
+ }
+
+ return fname;
+}
+
+//----------------------------------------------------------------------------
void
cmInstallTargetGenerator
::PrepareScriptReference(std::ostream& os, cmTarget* target,
@@ -212,52 +269,8 @@
AppendDirectoryForConfig("", i->c_str(), "/", fname);
}
- // Compute the name of the library.
- if(target->GetType() == cmTarget::EXECUTABLE)
- {
- std::string targetName;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- target->GetExecutableNames(targetName, targetNameReal,
- targetNameImport, targetNamePDB,
- i->c_str());
- if(this->ImportLibrary)
- {
- // Use the import library name.
- fname += targetNameImport;
- }
- else
- {
- // Use the canonical name.
- fname += targetName;
- }
- }
- else
- {
- std::string targetName;
- std::string targetNameSO;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
- targetNameImport, targetNamePDB, i->c_str());
- if(this->ImportLibrary)
- {
- // Use the import library name.
- fname += targetNameImport;
- }
- else if(useSOName)
- {
- // Use the soname.
- fname += targetNameSO;
- }
- else
- {
- // Use the canonical name.
- fname += targetName;
- }
- }
+ fname += this->GetInstallFilename(target, i->c_str(),
+ this->ImportLibrary, useSOName);
// Set a variable with the target name for this configuration.
os << "SET(" << target->GetName() << "_" << place
@@ -274,52 +287,8 @@
if(this->ConfigurationTypes->empty())
{
// Reference the target by its one configuration name.
- if(target->GetType() == cmTarget::EXECUTABLE)
- {
- std::string targetName;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- target->GetExecutableNames(targetName, targetNameReal,
- targetNameImport, targetNamePDB,
- this->ConfigurationName);
- if(this->ImportLibrary)
- {
- // Use the import library name.
- return targetNameImport;
- }
- else
- {
- // Use the canonical name.
- return targetName;
- }
- }
- else
- {
- std::string targetName;
- std::string targetNameSO;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
- targetNameImport, targetNamePDB,
- this->ConfigurationName);
- if(this->ImportLibrary)
- {
- // Use the import library name.
- return targetNameImport;
- }
- else if(useSOName)
- {
- // Use the soname.
- return targetNameSO;
- }
- else
- {
- // Use the canonical name.
- return targetName;
- }
- }
+ return this->GetInstallFilename(target, this->ConfigurationName,
+ this->ImportLibrary, useSOName);
}
else
{
More information about the Cmake-commits
mailing list