summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGeneratorTarget.cxx38
-rw-r--r--Source/cmGeneratorTarget.h11
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx4
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx8
-rw-r--r--Source/cmLocalVisualStudio7Generator.h3
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx2
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx4
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx2
-rw-r--r--Source/cmTarget.cxx38
-rw-r--r--Source/cmTarget.h11
11 files changed, 62 insertions, 61 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b6c2967..7e4c917 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -4399,6 +4399,44 @@ cmGeneratorTarget::GetLinkInformation(const std::string& config) const
}
//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetTargetVersion(int& major, int& minor) const
+{
+ int patch;
+ this->GetTargetVersion(false, major, minor, patch);
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetTargetVersion(bool soversion,
+ int& major, int& minor, int& patch) const
+{
+ // Set the default values.
+ major = 0;
+ minor = 0;
+ patch = 0;
+
+ assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+
+ // 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;
+ 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;
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
void
cmGeneratorTarget::ReportPropertyOrigin(const std::string &p,
const std::string &result,
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 0c198bb..f3b8d1f 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -445,6 +445,17 @@ public:
const char* ImportedGetLocation(const std::string& config) const;
+ /** Get the target major and minor version numbers interpreted from
+ the VERSION property. Version 0 is returned if the property is
+ not set or cannot be parsed. */
+ void GetTargetVersion(int& major, int& minor) const;
+
+ /** Get the target major, minor, and patch version numbers
+ interpreted from the VERSION or SOVERSION property. Version 0
+ is returned if the property is not set or cannot be parsed. */
+ void
+ GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index bc05aea..8454bc1 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2422,7 +2422,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
int patch;
// VERSION -> current_version
- target.GetTargetVersion(false, major, minor, patch);
+ gtgt->GetTargetVersion(false, major, minor, patch);
std::ostringstream v;
// Xcode always wants at least 1.0.0 or nothing
@@ -2434,7 +2434,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString(v.str().c_str()));
// SOVERSION -> compatibility_version
- target.GetTargetVersion(true, major, minor, patch);
+ gtgt->GetTargetVersion(true, major, minor, patch);
std::ostringstream vso;
// Xcode always wants at least 1.0.0 or nothing
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index b6f5aed..3e901ba 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1319,7 +1319,7 @@ void cmLocalVisualStudio6Generator
{
int major;
int minor;
- target.GetTargetVersion(major, minor);
+ gt->GetTargetVersion(major, minor);
std::ostringstream targetVersionStream;
targetVersionStream << "/version:" << major << "." << minor;
targetVersionFlag = targetVersionStream.str();
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 1122919..6d02bfa 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1215,7 +1215,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
- this->WriteTargetVersionAttribute(fout, target);
+ this->WriteTargetVersionAttribute(fout, gt);
linkOptions.OutputFlagMap(fout, "\t\t\t\t");
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, cli.GetDirectories());
@@ -1314,7 +1314,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
- this->WriteTargetVersionAttribute(fout, target);
+ this->WriteTargetVersionAttribute(fout, gt);
linkOptions.OutputFlagMap(fout, "\t\t\t\t");
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, cli.GetDirectories());
@@ -1384,11 +1384,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
//----------------------------------------------------------------------------
void
cmLocalVisualStudio7Generator
-::WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target)
+::WriteTargetVersionAttribute(std::ostream& fout, cmGeneratorTarget* gt)
{
int major;
int minor;
- target.GetTargetVersion(major, minor);
+ gt->GetTargetVersion(major, minor);
fout << "\t\t\t\tVersion=\"" << major << "." << minor << "\"\n";
}
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index ba6a72b..16cf004 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -106,7 +106,8 @@ private:
const char* source,
const cmCustomCommand& command,
FCInfo& fcinfo);
- void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
+ void WriteTargetVersionAttribute(std::ostream& fout,
+ cmGeneratorTarget* gt);
bool WriteGroup(const cmSourceGroup *sg,
cmTarget& target, std::ostream &fout,
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 2d2de5f..ea91095 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -382,7 +382,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::ostringstream minorStream;
int major;
int minor;
- this->Target->GetTargetVersion(major, minor);
+ this->GeneratorTarget->GetTargetVersion(major, minor);
majorStream << major;
minorStream << minor;
targetVersionMajor = majorStream.str();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index a0aa10b..6695143 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -630,7 +630,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::ostringstream minorStream;
int major;
int minor;
- this->Target->GetTargetVersion(major, minor);
+ this->GeneratorTarget->GetTargetVersion(major, minor);
majorStream << major;
minorStream << minor;
targetVersionMajor = majorStream.str();
@@ -862,7 +862,7 @@ cmMakefileLibraryTargetGenerator
int major;
int minor;
int patch;
- this->Target->GetTargetVersion(so, major, minor, patch);
+ this->GeneratorTarget->GetTargetVersion(so, major, minor, patch);
if(major > 0 || minor > 0 || patch > 0)
{
// Append the flag since a non-zero version is specified.
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 066c64e..a8f182b 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -227,7 +227,7 @@ cmNinjaNormalTargetGenerator
std::ostringstream minorStream;
int major;
int minor;
- this->GetTarget()->GetTargetVersion(major, minor);
+ this->GetGeneratorTarget()->GetTargetVersion(major, minor);
majorStream << major;
minorStream << minor;
targetVersionMajor = majorStream.str();
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7f21efe..850fc6a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1616,44 +1616,6 @@ bool cmTarget::HaveWellDefinedOutputFiles() const
}
//----------------------------------------------------------------------------
-void cmTarget::GetTargetVersion(int& major, int& minor) const
-{
- int patch;
- this->GetTargetVersion(false, major, minor, patch);
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::GetTargetVersion(bool soversion,
- int& major, int& minor, int& patch) const
-{
- // Set the default values.
- major = 0;
- minor = 0;
- patch = 0;
-
- assert(this->GetType() != cmState::INTERFACE_LIBRARY);
-
- // 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;
- 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;
- }
- }
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
{
if (this->IsImported())
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 6cd876e..a9d2454 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -213,17 +213,6 @@ public:
bool IsImported() const {return this->IsImportedTarget;}
- /** Get the target major and minor version numbers interpreted from
- the VERSION property. Version 0 is returned if the property is
- not set or cannot be parsed. */
- void GetTargetVersion(int& major, int& minor) const;
-
- /** Get the target major, minor, and patch version numbers
- interpreted from the VERSION or SOVERSION property. Version 0
- is returned if the property is not set or cannot be parsed. */
- void
- GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
-
// Get the properties
cmPropertyMap &GetProperties() const { return this->Properties; }