diff options
author | Brad King <brad.king@kitware.com> | 2009-05-01 14:38:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-05-01 14:38:35 (GMT) |
commit | 430cc2b4b7a817be2fbc445d6803163f1695a533 (patch) | |
tree | f41fc7fbf2fb1671bb0fa3b9e36bc6ecc5403957 /Source/cmMakefileLibraryTargetGenerator.cxx | |
parent | 2740db5eded92d61ae38e69d67a4e4179ae5d20e (diff) | |
download | CMake-430cc2b4b7a817be2fbc445d6803163f1695a533.zip CMake-430cc2b4b7a817be2fbc445d6803163f1695a533.tar.gz CMake-430cc2b4b7a817be2fbc445d6803163f1695a533.tar.bz2 |
ENH: Always imply CLEAN_DIRECT_OUTPUT target prop
This property was left from before CMake always linked using full path
library names for targets it builds. In order to safely link with
"-lfoo" we needed to avoid having both shared and static libraries in
the build tree for targets that switch on BUILD_SHARED_LIBS. This meant
cleaning both shared and static names before creating the library, which
led to the creation of CLEAN_DIRECT_OUTPUT to disable the behavior.
Now that we always link with a full path we do not need to clean old
library names left from an alternate setting of BUILD_SHARED_LIBS. This
change removes the CLEAN_DIRECT_OUTPUT property and instead uses its
behavior always. It removes some complexity from cmTarget internally.
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 119 |
1 files changed, 28 insertions, 91 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 0e71d50..ec9789f 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -485,101 +485,38 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules default: break; } - // Construct a list of files associated with this library that may - // need to be cleaned. + // Clean files associated with this library. std::vector<std::string> libCleanFiles; - if(this->Target->GetPropertyAsBool("CLEAN_DIRECT_OUTPUT")) - { - // 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()) - { - libCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED)); - } + 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)); } - else + if(targetNameSO != targetName && + targetNameSO != targetNameReal) { - // 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; - std::string cleanPDBName; - this->Target->GetLibraryCleanNames( - cleanStaticName, - cleanSharedName, - cleanSharedSOName, - cleanSharedRealName, - cleanImportName, - cleanPDBName, - 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 = outpathImp + cleanImportName; - std::string cleanFullPDBName = outpath + cleanPDBName; - 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()) - { - libCleanFiles.push_back(this->Convert(cleanFullImportName.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED)); - } - - // List the PDB for cleaning only when the whole target is - // cleaned. We do not want to delete the .pdb file just before - // linking the target. - this->CleanFiles.push_back - (this->Convert(cleanFullPDBName.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED)); + libCleanFiles.push_back(this->Convert(targetFullPathSO.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED)); } + if(!targetNameImport.empty()) + { + libCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED)); + } + + // List the PDB for cleaning only when the whole target is + // cleaned. We do not want to delete the .pdb file just before + // linking the target. + this->CleanFiles.push_back + (this->Convert(targetFullPathPDB.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED)); #ifdef _WIN32 // There may be a manifest file for this target. Add it to the |