diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-04 17:19:44 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-08-05 16:20:46 (GMT) |
commit | 47803e6f8e98984e740acf2f7c0a217de58717cd (patch) | |
tree | 37fed0fa8c383d533c0be33d322518b2739080d9 /Source/cmGeneratorTarget.cxx | |
parent | 7da4c9d4edbdd6df6aa2a9467d6f32a98fc8cac4 (diff) | |
download | CMake-47803e6f8e98984e740acf2f7c0a217de58717cd.zip CMake-47803e6f8e98984e740acf2f7c0a217de58717cd.tar.gz CMake-47803e6f8e98984e740acf2f7c0a217de58717cd.tar.bz2 |
cmGeneratorTarget: Move GetExecutableNames from cmTarget.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f9f23a6..6a693f1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1248,8 +1248,7 @@ void cmGeneratorTarget::GenerateTargetManifest( std::string pdbName; if(this->GetType() == cmTarget::EXECUTABLE) { - this->Target->GetExecutableNames(name, realName, impName, pdbName, - config); + this->GetExecutableNames(name, realName, impName, pdbName, config); } else if(this->GetType() == cmTarget::STATIC_LIBRARY || this->GetType() == cmTarget::SHARED_LIBRARY || @@ -1368,7 +1367,7 @@ cmGeneratorTarget::NormalGetRealName(const std::string& config) const std::string realName; std::string impName; std::string pdbName; - this->Target->GetExecutableNames(name, realName, impName, pdbName, config); + this->GetExecutableNames(name, realName, impName, pdbName, config); return realName; } else @@ -1385,6 +1384,69 @@ cmGeneratorTarget::NormalGetRealName(const std::string& config) const } } +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetExecutableNames(std::string& name, + std::string& realName, + std::string& impName, + std::string& pdbName, + const std::string& config) const +{ + // This should not be called for imported targets. + // TODO: Split cmTarget into a class hierarchy to get compile-time + // enforcement of the limited imported target API. + if(this->Target->IsImported()) + { + std::string msg = + "GetExecutableNames called on imported target: "; + msg += this->GetName(); + this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg); + } + + // This versioning is supported only for executables and then only + // when the platform supports symbolic links. +#if defined(_WIN32) && !defined(__CYGWIN__) + const char* version = 0; +#else + // Check for executable version properties. + const char* version = this->GetProperty("VERSION"); + if(this->GetType() != cmTarget::EXECUTABLE || this->Makefile->IsOn("XCODE")) + { + version = 0; + } +#endif + + // Get the components of the executable name. + std::string prefix; + std::string base; + std::string suffix; + this->Target->GetFullNameInternal(config, false, prefix, base, suffix); + + // The executable name. + name = prefix+base+suffix; + + // The executable's real name on disk. +#if defined(__CYGWIN__) + realName = prefix+base; +#else + realName = name; +#endif + if(version) + { + realName += "-"; + realName += version; + } +#if defined(__CYGWIN__) + realName += suffix; +#endif + + // The import library name. + impName = this->Target->GetFullNameInternal(config, true); + + // The program database file name. + pdbName = this->Target->GetPDBName(config); +} + + bool cmStrictTargetComparison::operator()(cmTarget const* t1, cmTarget const* t2) const { |