summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileLibraryTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-08-03 13:42:48 (GMT)
committerBrad King <brad.king@kitware.com>2006-08-03 13:42:48 (GMT)
commit441d208bb323b49bc7a42036d17fb5eb2a9cba48 (patch)
tree6bd8a4c10987d0c1b5cefe2f71a65fed2adf2160 /Source/cmMakefileLibraryTargetGenerator.cxx
parent24b55bfe11db52b37795b241272b0a1511e12bd5 (diff)
downloadCMake-441d208bb323b49bc7a42036d17fb5eb2a9cba48.zip
CMake-441d208bb323b49bc7a42036d17fb5eb2a9cba48.tar.gz
CMake-441d208bb323b49bc7a42036d17fb5eb2a9cba48.tar.bz2
ENH: Added target property CLEAN_DIRECT_OUTPUT to not clean all forms of a library name so that static and shared libraries of the same name can coexist in a single build directory.
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx132
1 files changed, 83 insertions, 49 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 0009429..0697e2c 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -305,59 +305,93 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Construct a list of files associated with this library that may
// need to be cleaned.
std::vector<std::string> libCleanFiles;
- {
- std::string cleanStaticName;
- std::string cleanSharedName;
- std::string cleanSharedSOName;
- std::string cleanSharedRealName;
- std::string cleanImportName;
- this->Target->GetLibraryCleanNames(
- cleanStaticName,
- cleanSharedName,
- cleanSharedSOName,
- cleanSharedRealName,
- cleanImportName,
- this->LocalGenerator->ConfigurationName.c_str());
- std::string cleanFullStaticName = outpath + cleanStaticName;
- std::string cleanFullSharedName = outpath + cleanSharedName;
- std::string cleanFullSharedSOName = outpath + cleanSharedSOName;
- std::string cleanFullSharedRealName = outpath + cleanSharedRealName;
- std::string cleanFullImportName = outpath + cleanImportName;
- libCleanFiles.push_back
- (this->Convert(cleanFullStaticName.c_str(),cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
- if(cleanSharedRealName != cleanStaticName)
- {
- libCleanFiles.push_back(this->Convert(cleanFullSharedRealName.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
- }
- if(cleanSharedSOName != cleanStaticName &&
- cleanSharedSOName != cleanSharedRealName)
- {
- libCleanFiles.push_back(this->Convert(cleanFullSharedSOName.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
- }
- if(cleanSharedName != cleanStaticName &&
- cleanSharedName != cleanSharedSOName &&
- cleanSharedName != cleanSharedRealName)
+ if(this->Target->GetPropertyAsBool("CLEAN_DIRECT_OUTPUT"))
{
- libCleanFiles.push_back(this->Convert(cleanFullSharedName.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ // The user has requested that only the files directly built
+ // by this target be cleaned instead of all possible names.
+ libCleanFiles.push_back(this->Convert(targetFullPath.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ if(targetNameReal != targetName)
+ {
+ libCleanFiles.push_back(this->Convert(targetFullPathReal.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
+ if(targetNameSO != targetName &&
+ targetNameSO != targetNameReal)
+ {
+ libCleanFiles.push_back(this->Convert(targetFullPathSO.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
+ if(!targetNameImport.empty() &&
+ targetNameImport != targetName &&
+ targetNameImport != targetNameReal &&
+ targetNameImport != targetNameSO)
+ {
+ libCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
}
- if(!cleanImportName.empty() &&
- cleanImportName != cleanStaticName &&
- cleanImportName != cleanSharedSOName &&
- cleanImportName != cleanSharedRealName &&
- cleanImportName != cleanSharedName)
+ else
{
- libCleanFiles.push_back(this->Convert(cleanFullImportName.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ // This target may switch between static and shared based
+ // on a user option or the BUILD_SHARED_LIBS switch. Clean
+ // all possible names.
+ std::string cleanStaticName;
+ std::string cleanSharedName;
+ std::string cleanSharedSOName;
+ std::string cleanSharedRealName;
+ std::string cleanImportName;
+ this->Target->GetLibraryCleanNames(
+ cleanStaticName,
+ cleanSharedName,
+ cleanSharedSOName,
+ cleanSharedRealName,
+ cleanImportName,
+ this->LocalGenerator->ConfigurationName.c_str());
+ std::string cleanFullStaticName = outpath + cleanStaticName;
+ std::string cleanFullSharedName = outpath + cleanSharedName;
+ std::string cleanFullSharedSOName = outpath + cleanSharedSOName;
+ std::string cleanFullSharedRealName = outpath + cleanSharedRealName;
+ std::string cleanFullImportName = outpath + cleanImportName;
+ libCleanFiles.push_back
+ (this->Convert(cleanFullStaticName.c_str(),cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ if(cleanSharedRealName != cleanStaticName)
+ {
+ libCleanFiles.push_back(this->Convert(cleanFullSharedRealName.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
+ if(cleanSharedSOName != cleanStaticName &&
+ cleanSharedSOName != cleanSharedRealName)
+ {
+ libCleanFiles.push_back(this->Convert(cleanFullSharedSOName.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
+ if(cleanSharedName != cleanStaticName &&
+ cleanSharedName != cleanSharedSOName &&
+ cleanSharedName != cleanSharedRealName)
+ {
+ libCleanFiles.push_back(this->Convert(cleanFullSharedName.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
+ if(!cleanImportName.empty() &&
+ cleanImportName != cleanStaticName &&
+ cleanImportName != cleanSharedSOName &&
+ cleanImportName != cleanSharedRealName &&
+ cleanImportName != cleanSharedName)
+ {
+ libCleanFiles.push_back(this->Convert(cleanFullImportName.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
}
- }
// Add a command to remove any existing files for this library.
std::vector<std::string> commands1;
this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles,