summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-07-09 14:09:00 (GMT)
committerBrad King <brad.king@kitware.com>2008-07-09 14:09:00 (GMT)
commitda4f142cc12cf603f7d34562d558c0ed7bd65d5f (patch)
treecc4edfa216e0fc4485e1f094f94578d30305c3ef /Source/cmTarget.cxx
parentba8452420738a1adf58186367eeb24de3c7a56e5 (diff)
downloadCMake-da4f142cc12cf603f7d34562d558c0ed7bd65d5f.zip
CMake-da4f142cc12cf603f7d34562d558c0ed7bd65d5f.tar.gz
CMake-da4f142cc12cf603f7d34562d558c0ed7bd65d5f.tar.bz2
ENH: Add full target version signature cmTarget::GetTargetVersion.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c4cc793..6e81a1a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1756,19 +1756,32 @@ const char* cmTarget::NormalGetLocation(const char* config)
//----------------------------------------------------------------------------
void cmTarget::GetTargetVersion(int& major, int& minor)
{
+ int patch;
+ this->GetTargetVersion(false, major, minor, patch);
+}
+
+//----------------------------------------------------------------------------
+void cmTarget::GetTargetVersion(bool soversion,
+ int& major, int& minor, int& patch)
+{
// Set the default values.
major = 0;
minor = 0;
+ patch = 0;
- // Look for a VERSION property.
- if(const char* version = this->GetProperty("VERSION"))
+ // Look for a VERSION or SOVERSION property.
+ const char* prop = soversion? "SOVERSION" : "VERSION";
+ if(const char* version = this->GetProperty(prop))
{
// 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))
+ int parsed_patch;
+ switch(sscanf(version, "%d.%d.%d",
+ &parsed_major, &parsed_minor, &parsed_patch))
{
+ case 3: patch = parsed_patch; // no break!
case 2: minor = parsed_minor; // no break!
case 1: major = parsed_major; // no break!
default: break;