summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-08-05 17:11:48 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-10 09:03:48 (GMT)
commit110fd2fba1cbd6c3d89f5460d3f58a94d52d4546 (patch)
tree7acd538caf5325f28550bac50a61f264574c03fe /Source/cmGeneratorTarget.cxx
parente73916992c6893572f24ee4fa631b33445d6cdf6 (diff)
downloadCMake-110fd2fba1cbd6c3d89f5460d3f58a94d52d4546.zip
CMake-110fd2fba1cbd6c3d89f5460d3f58a94d52d4546.tar.gz
CMake-110fd2fba1cbd6c3d89f5460d3f58a94d52d4546.tar.bz2
cmGeneratorTarget: Move GetOutputTargetType from cmTarget.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx60
1 files changed, 58 insertions, 2 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b253836..8663593 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -340,6 +340,62 @@ const char *cmGeneratorTarget::GetProperty(const std::string& prop) const
}
//----------------------------------------------------------------------------
+const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
+{
+ switch(this->GetType())
+ {
+ case cmTarget::SHARED_LIBRARY:
+ if(this->Target->IsDLLPlatform())
+ {
+ if(implib)
+ {
+ // A DLL import library is treated as an archive target.
+ return "ARCHIVE";
+ }
+ else
+ {
+ // A DLL shared library is treated as a runtime target.
+ return "RUNTIME";
+ }
+ }
+ else
+ {
+ // For non-DLL platforms shared libraries are treated as
+ // library targets.
+ return "LIBRARY";
+ }
+ case cmTarget::STATIC_LIBRARY:
+ // Static libraries are always treated as archive targets.
+ return "ARCHIVE";
+ case cmTarget::MODULE_LIBRARY:
+ if(implib)
+ {
+ // Module libraries are always treated as library targets.
+ return "ARCHIVE";
+ }
+ else
+ {
+ // Module import libraries are treated as archive targets.
+ return "LIBRARY";
+ }
+ case cmTarget::EXECUTABLE:
+ if(implib)
+ {
+ // Executable import libraries are treated as archive targets.
+ return "ARCHIVE";
+ }
+ else
+ {
+ // Executables are always treated as runtime targets.
+ return "RUNTIME";
+ }
+ default:
+ break;
+ }
+ return "";
+}
+
+//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetOutputName(const std::string& config,
bool implib) const
{
@@ -355,7 +411,7 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config,
// Compute output name.
std::vector<std::string> props;
- std::string type = this->Target->GetOutputTargetType(implib);
+ std::string type = this->GetOutputTargetType(implib);
std::string configUpper = cmSystemTools::UpperCase(config);
if(!type.empty() && !configUpper.empty())
{
@@ -4662,7 +4718,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
// Look for a target property defining the target output directory
// based on the target type.
- std::string targetTypeName = this->Target->GetOutputTargetType(implib);
+ std::string targetTypeName = this->GetOutputTargetType(implib);
const char* propertyName = 0;
std::string propertyNameStr = targetTypeName;
if(!propertyNameStr.empty())