summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-19 22:57:35 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-20 22:52:22 (GMT)
commit91411641a7b8029d05899b11590fb4e676716a85 (patch)
tree0e550426997002746803ce767d882f91afb9ead3
parent6d94078e623d5f1316f1972ffda06ac1d66b6f2f (diff)
downloadCMake-91411641a7b8029d05899b11590fb4e676716a85.zip
CMake-91411641a7b8029d05899b11590fb4e676716a85.tar.gz
CMake-91411641a7b8029d05899b11590fb4e676716a85.tar.bz2
Move ComputeLinkType out of cmTarget.
Keep it out of the way, so that it does not become part of cmGeneratorTarget, but where it can be used to implement CMP0003.
-rw-r--r--Source/cmComputeLinkDepends.cxx4
-rw-r--r--Source/cmGeneratorTarget.cxx7
-rw-r--r--Source/cmLinkItem.h24
-rw-r--r--Source/cmTarget.cxx25
-rw-r--r--Source/cmTarget.h3
5 files changed, 33 insertions, 30 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 465db92..13098ad 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -185,7 +185,9 @@ cmComputeLinkDepends
// The configuration being linked.
this->HasConfig = !config.empty();
this->Config = (this->HasConfig)? config : std::string();
- this->LinkType = this->Target->Target->ComputeLinkType(this->Config);
+ std::vector<std::string> debugConfigs =
+ this->Makefile->GetCMakeInstance()->GetDebugConfigs();
+ this->LinkType = CMP0003_ComputeLinkType(this->Config, debugConfigs);
// Enable debug mode if requested.
this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE");
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 6e312ce..2a35259 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5877,7 +5877,12 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
this->MaxLanguageStandards);
}
- cmTargetLinkLibraryType linkType = this->Target->ComputeLinkType(config);
+ // Get the list of configurations considered to be DEBUG.
+ std::vector<std::string> debugConfigs =
+ this->Makefile->GetCMakeInstance()->GetDebugConfigs();
+
+ cmTargetLinkLibraryType linkType =
+ CMP0003_ComputeLinkType(config, debugConfigs);
cmTarget::LinkLibraryVectorType const& oldllibs =
this->Target->GetOriginalLinkLibraries();
for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index b875cc0..b603bcc 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -14,6 +14,7 @@
#define cmLinkItem_h
#include "cmListFileCache.h"
+#include "cmSystemTools.h"
class cmGeneratorTarget;
@@ -118,4 +119,27 @@ struct cmOptionalLinkImplementation: public cmLinkImplementation
bool HadHeadSensitiveCondition;
};
+/** Compute the link type to use for the given configuration. */
+inline cmTargetLinkLibraryType
+CMP0003_ComputeLinkType(const std::string& config,
+ std::vector<std::string> const& debugConfigs)
+{
+ // No configuration is always optimized.
+ if(config.empty())
+ {
+ return OPTIMIZED_LibraryType;
+ }
+
+ // Check if any entry in the list matches this configuration.
+ std::string configUpper = cmSystemTools::UpperCase(config);
+ if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) !=
+ debugConfigs.end())
+ {
+ return DEBUG_LibraryType;
+ }
+ // The current configuration is not a debug configuration.
+ return OPTIMIZED_LibraryType;
+}
+
+
#endif
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 63d3d07..0d8c57d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -583,31 +583,6 @@ const std::vector<std::string>& cmTarget::GetLinkDirectories() const
}
//----------------------------------------------------------------------------
-cmTargetLinkLibraryType cmTarget::ComputeLinkType(
- const std::string& config) const
-{
- // No configuration is always optimized.
- if(config.empty())
- {
- return OPTIMIZED_LibraryType;
- }
-
- // Get the list of configurations considered to be DEBUG.
- std::vector<std::string> debugConfigs =
- this->Makefile->GetCMakeInstance()->GetDebugConfigs();
-
- // Check if any entry in the list matches this configuration.
- std::string configUpper = cmSystemTools::UpperCase(config);
- if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) !=
- debugConfigs.end())
- {
- return DEBUG_LibraryType;
- }
- // The current configuration is not a debug configuration.
- return OPTIMIZED_LibraryType;
-}
-
-//----------------------------------------------------------------------------
void cmTarget::ClearDependencyInformation( cmMakefile& mf,
const std::string& target )
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 33631e7..9ed7f84 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -140,9 +140,6 @@ public:
const LinkLibraryVectorType &GetOriginalLinkLibraries() const
{return this->OriginalLinkLibraries;}
- /** Compute the link type to use for the given configuration. */
- cmTargetLinkLibraryType ComputeLinkType(const std::string& config) const;
-
/**
* Clear the dependency information recorded for this target, if any.
*/