[Cmake-commits] [cmake-commits] king committed cmMakefileLibraryTargetGenerator.cxx 1.71 1.72 cmSetTargetPropertiesCommand.h 1.32 1.33 cmTarget.cxx 1.241 1.242 cmTarget.h 1.123 1.124
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri May 1 10:38:36 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv31875/Source
Modified Files:
cmMakefileLibraryTargetGenerator.cxx
cmSetTargetPropertiesCommand.h cmTarget.cxx cmTarget.h
Log Message:
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.
Index: cmMakefileLibraryTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v
retrieving revision 1.71
retrieving revision 1.72
diff -C 2 -d -r1.71 -r1.72
*** cmMakefileLibraryTargetGenerator.cxx 16 Mar 2009 20:55:58 -0000 1.71
--- cmMakefileLibraryTargetGenerator.cxx 1 May 2009 14:38:28 -0000 1.72
***************
*** 486,584 ****
}
! // Construct a list of files associated with this library that may
! // need to be cleaned.
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));
! }
}
! else
{
! // 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));
}
#ifdef _WIN32
--- 486,521 ----
}
! // Clean files associated with this library.
std::vector<std::string> libCleanFiles;
! 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));
+ }
+
+ // 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
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.123
retrieving revision 1.124
diff -C 2 -d -r1.123 -r1.124
*** cmTarget.h 1 May 2009 13:45:41 -0000 1.123
--- cmTarget.h 1 May 2009 14:38:34 -0000 1.124
***************
*** 327,342 ****
std::string& pdbName, const char* config);
- /** Get the names of the library used to remove existing copies of
- the library from the build tree either before linking or during
- a clean step. This should be called only on a library
- target. */
- void GetLibraryCleanNames(std::string& staticName,
- std::string& sharedName,
- std::string& sharedSOName,
- std::string& sharedRealName,
- std::string& importName,
- std::string& pdbName,
- const char* config);
-
/** Get the names of the executable needed to generate a build rule
that takes into account executable version numbers. This should
--- 327,330 ----
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.241
retrieving revision 1.242
diff -C 2 -d -r1.241 -r1.242
*** cmTarget.cxx 1 May 2009 13:45:40 -0000 1.241
--- cmTarget.cxx 1 May 2009 14:38:32 -0000 1.242
***************
*** 79,93 ****
cm->DefineProperty
- ("CLEAN_DIRECT_OUTPUT", cmProperty::TARGET,
- "Do not delete other variants of this target.",
- "When a library is built CMake by default generates code to remove "
- "any existing library using all possible names. This is needed "
- "to support libraries that switch between STATIC and SHARED by "
- "a user option. However when using OUTPUT_NAME to build a static "
- "and shared library of the same name using different logical target "
- "names the two targets will remove each other's files. This can be "
- "prevented by setting the CLEAN_DIRECT_OUTPUT property to 1.");
-
- cm->DefineProperty
("COMPILE_FLAGS", cmProperty::TARGET,
"Additional flags to use when compiling this target's sources.",
--- 79,82 ----
***************
*** 2725,2765 ****
//----------------------------------------------------------------------------
- void cmTarget::GetLibraryCleanNames(std::string& staticName,
- std::string& sharedName,
- std::string& sharedSOName,
- std::string& sharedRealName,
- std::string& importName,
- std::string& pdbName,
- const char* config)
- {
- // Get the name as if this were a static library.
- std::string soName;
- std::string realName;
- std::string impName;
- this->GetLibraryNamesInternal(staticName, soName, realName, impName,
- pdbName, cmTarget::STATIC_LIBRARY, config);
-
- // Get the names as if this were a shared library.
- if(this->GetType() == cmTarget::STATIC_LIBRARY)
- {
- // Since the real type is static then the user either specified
- // STATIC or did not specify a type. In the former case the
- // shared library will never be present. In the latter case the
- // type will never be MODULE. Either way the only names that
- // might have to be cleaned are the shared library names.
- this->GetLibraryNamesInternal(sharedName, sharedSOName, sharedRealName,
- importName, pdbName,
- cmTarget::SHARED_LIBRARY, config);
- }
- else
- {
- // Use the name of the real type of the library (shared or module).
- this->GetLibraryNamesInternal(sharedName, sharedSOName, sharedRealName,
- importName, pdbName, this->GetType(),
- config);
- }
- }
-
- //----------------------------------------------------------------------------
void cmTarget::GetLibraryNamesInternal(std::string& name,
std::string& soName,
--- 2714,2717 ----
Index: cmSetTargetPropertiesCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSetTargetPropertiesCommand.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C 2 -d -r1.32 -r1.33
*** cmSetTargetPropertiesCommand.h 7 Oct 2008 20:23:20 -0000 1.32
--- cmSetTargetPropertiesCommand.h 1 May 2009 14:38:30 -0000 1.33
***************
*** 149,159 ****
"to add support for source control bindings in a Visual Studio "
"project file.\n"
- "When a library is built CMake by default generates code to remove "
- "any existing library using all possible names. This is needed "
- "to support libraries that switch between STATIC and SHARED by "
- "a user option. However when using OUTPUT_NAME to build a static "
- "and shared library of the same name using different logical target "
- "names the two targets will remove each other's files. This can be "
- "prevented by setting the CLEAN_DIRECT_OUTPUT property to 1.\n"
"The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the "
"old way to specify CMake scripts to run before and after "
--- 149,152 ----
More information about the Cmake-commits
mailing list