diff options
author | Brad King <brad.king@kitware.com> | 2006-10-16 22:17:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-10-16 22:17:14 (GMT) |
commit | b155f3aa1c4bb503557bda801059e0b6a28898cf (patch) | |
tree | ab38724144a719aefc05faa830e004f967ade52d /Source/cmTarget.cxx | |
parent | 30235517f81ed7ef8ff8e58685e786da472bf0d6 (diff) | |
download | CMake-b155f3aa1c4bb503557bda801059e0b6a28898cf.zip CMake-b155f3aa1c4bb503557bda801059e0b6a28898cf.tar.gz CMake-b155f3aa1c4bb503557bda801059e0b6a28898cf.tar.bz2 |
ENH: Adding image version number (major.minor) property to windows binaries. Default is 0.0, but the VERSION target property may change the value. Windows now has first-class support for dll and exe versioning. This addresses bug#1219.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9ac85ee..18cce53 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -890,6 +890,29 @@ const char* cmTarget::GetLocation(const char* config) return this->Location.c_str(); } +//---------------------------------------------------------------------------- +void cmTarget::GetTargetVersion(int& major, int& minor) +{ + // Set the default values. + major = 0; + minor = 0; + + // Look for a VERSION property. + if(const char* version = this->GetProperty("VERSION")) + { + // Try to parse the version number and store the results that were + // successfully parsed. + int parsed_major; + int parsed_minor; + switch(sscanf(version, "%d.%d", &parsed_major, &parsed_minor)) + { + case 2: minor = parsed_minor; // no break! + case 1: major = parsed_major; // no break! + default: break; + } + } +} + const char *cmTarget::GetProperty(const char* prop) { // watch for special "computed" properties that are dependent on other @@ -1442,16 +1465,29 @@ void cmTarget::GetExecutableNamesInternal(std::string& name, } #endif + // Get the components of the executable name. + std::string prefix; + std::string base; + std::string suffix; + this->GetFullNameInternal(type, config, false, prefix, base, suffix); + // The executable name. - name = this->GetFullNameInternal(type, config, false); + 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 } //---------------------------------------------------------------------------- |