cmTarget: Compile old-style link dependencies only for VS 6

Compile all the "ForVS6" cmTarget members only on Windows.  No other
platforms support the VS 6 generator.
This commit is contained in:
Brad King 2014-07-14 14:39:20 -04:00
parent d57be904ae
commit 8a205b980c
3 changed files with 20 additions and 3 deletions

View File

@ -214,8 +214,10 @@ public:
*/ */
virtual void FindMakeProgram(cmMakefile*); virtual void FindMakeProgram(cmMakefile*);
#if defined(_WIN32) && !defined(__CYGWIN__)
/** Is this the Visual Studio 6 generator? */ /** Is this the Visual Studio 6 generator? */
virtual bool IsForVS6() const { return false; } virtual bool IsForVS6() const { return false; }
#endif
///! Find a target by name by searching the local generators. ///! Find a target by name by searching the local generators.
cmTarget* FindTarget(const std::string& name, cmTarget* FindTarget(const std::string& name,

View File

@ -258,7 +258,9 @@ cmTarget::cmTarget()
#undef INITIALIZE_TARGET_POLICY_MEMBER #undef INITIALIZE_TARGET_POLICY_MEMBER
this->Makefile = 0; this->Makefile = 0;
#if defined(_WIN32) && !defined(__CYGWIN__)
this->LinkLibrariesForVS6Analyzed = false; this->LinkLibrariesForVS6Analyzed = false;
#endif
this->HaveInstallRule = false; this->HaveInstallRule = false;
this->DLLPlatform = false; this->DLLPlatform = false;
this->IsApple = false; this->IsApple = false;
@ -517,11 +519,13 @@ void cmTarget::FinishConfigure()
// invalidation code in this source file is buggy. // invalidation code in this source file is buggy.
this->ClearLinkMaps(); this->ClearLinkMaps();
#if defined(_WIN32) && !defined(__CYGWIN__)
// Do old-style link dependency analysis only for CM_USE_OLD_VS6. // Do old-style link dependency analysis only for CM_USE_OLD_VS6.
if(this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->IsForVS6()) if(this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->IsForVS6())
{ {
this->AnalyzeLibDependenciesForVS6(*this->Makefile); this->AnalyzeLibDependenciesForVS6(*this->Makefile);
} }
#endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1335,7 +1339,9 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
cmTarget::LibraryID tmp; cmTarget::LibraryID tmp;
tmp.first = lib; tmp.first = lib;
tmp.second = llt; tmp.second = llt;
#if defined(_WIN32) && !defined(__CYGWIN__)
this->LinkLibrariesForVS6.push_back( tmp ); this->LinkLibrariesForVS6.push_back( tmp );
#endif
this->OriginalLinkLibraries.push_back(tmp); this->OriginalLinkLibraries.push_back(tmp);
this->ClearLinkMaps(); this->ClearLinkMaps();
@ -1401,6 +1407,7 @@ cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs)
} }
} }
#if defined(_WIN32) && !defined(__CYGWIN__)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmTarget::AnalyzeLibDependenciesForVS6( const cmMakefile& mf ) cmTarget::AnalyzeLibDependenciesForVS6( const cmMakefile& mf )
@ -1693,6 +1700,7 @@ void cmTarget::GatherDependenciesForVS6( const cmMakefile& mf,
this->DeleteDependencyForVS6( dep_map, lib, lib); this->DeleteDependencyForVS6( dep_map, lib, lib);
} }
} }
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool whiteListedInterfaceProperty(const std::string& prop) static bool whiteListedInterfaceProperty(const std::string& prop)

View File

@ -179,8 +179,6 @@ public:
typedef std::pair<std::string, LinkLibraryType> LibraryID; typedef std::pair<std::string, LinkLibraryType> LibraryID;
typedef std::vector<LibraryID > LinkLibraryVectorType; typedef std::vector<LibraryID > LinkLibraryVectorType;
const LinkLibraryVectorType &GetLinkLibrariesForVS6() const {
return this->LinkLibrariesForVS6;}
const LinkLibraryVectorType &GetOriginalLinkLibraries() const const LinkLibraryVectorType &GetOriginalLinkLibraries() const
{return this->OriginalLinkLibraries;} {return this->OriginalLinkLibraries;}
@ -613,6 +611,11 @@ public:
return this->MaxLanguageStandards; return this->MaxLanguageStandards;
} }
#if defined(_WIN32) && !defined(__CYGWIN__)
const LinkLibraryVectorType &GetLinkLibrariesForVS6() const {
return this->LinkLibrariesForVS6;}
#endif
private: private:
bool HandleLocationPropertyPolicy(cmMakefile* context) const; bool HandleLocationPropertyPolicy(cmMakefile* context) const;
@ -622,6 +625,7 @@ private:
std::vector<std::pair<TLLSignature, cmListFileBacktrace> > TLLCommands; std::vector<std::pair<TLLSignature, cmListFileBacktrace> > TLLCommands;
#if defined(_WIN32) && !defined(__CYGWIN__)
/** /**
* A list of direct dependencies. Use in conjunction with DependencyMap. * A list of direct dependencies. Use in conjunction with DependencyMap.
*/ */
@ -672,6 +676,7 @@ private:
DependencyMap& dep_map); DependencyMap& dep_map);
void AnalyzeLibDependenciesForVS6( const cmMakefile& mf ); void AnalyzeLibDependenciesForVS6( const cmMakefile& mf );
#endif
const char* GetSuffixVariableInternal(bool implib) const; const char* GetSuffixVariableInternal(bool implib) const;
const char* GetPrefixVariableInternal(bool implib) const; const char* GetPrefixVariableInternal(bool implib) const;
@ -720,9 +725,11 @@ private:
std::vector<cmCustomCommand> PreLinkCommands; std::vector<cmCustomCommand> PreLinkCommands;
std::vector<cmCustomCommand> PostBuildCommands; std::vector<cmCustomCommand> PostBuildCommands;
TargetType TargetTypeValue; TargetType TargetTypeValue;
LinkLibraryVectorType LinkLibrariesForVS6;
LinkLibraryVectorType PrevLinkedLibraries; LinkLibraryVectorType PrevLinkedLibraries;
#if defined(_WIN32) && !defined(__CYGWIN__)
LinkLibraryVectorType LinkLibrariesForVS6;
bool LinkLibrariesForVS6Analyzed; bool LinkLibrariesForVS6Analyzed;
#endif
std::vector<std::string> LinkDirectories; std::vector<std::string> LinkDirectories;
std::set<std::string> LinkDirectoriesEmmitted; std::set<std::string> LinkDirectoriesEmmitted;
bool HaveInstallRule; bool HaveInstallRule;