summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx36
1 files changed, 32 insertions, 4 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6ae073b..9f1c50a 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1459,10 +1459,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("DYNAMIC"));
- buildSettings->AddAttribute("DYLIB_COMPATIBILITY_VERSION",
- this->CreateString("1"));
- buildSettings->AddAttribute("DYLIB_CURRENT_VERSION",
- this->CreateString("1"));
break;
}
case cmTarget::EXECUTABLE:
@@ -1680,6 +1676,38 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString(
"-Wmost -Wno-four-char-constants"
" -Wno-unknown-pragmas"));
+
+ // Runtime version information.
+ if(target.GetType() == cmTarget::SHARED_LIBRARY)
+ {
+ int major;
+ int minor;
+ int patch;
+
+ // VERSION -> current_version
+ target.GetTargetVersion(false, major, minor, patch);
+ if(major == 0 && minor == 0 && patch == 0)
+ {
+ // Xcode always wants at least 1.0.0
+ major = 1;
+ }
+ cmOStringStream v;
+ v << major << "." << minor << "." << patch;
+ buildSettings->AddAttribute("DYLIB_CURRENT_VERSION",
+ this->CreateString(v.str().c_str()));
+
+ // SOVERSION -> compatibility_version
+ target.GetTargetVersion(true, major, minor, patch);
+ if(major == 0 && minor == 0 && patch == 0)
+ {
+ // Xcode always wants at least 1.0.0
+ major = 1;
+ }
+ cmOStringStream vso;
+ vso << major << "." << minor << "." << patch;
+ buildSettings->AddAttribute("DYLIB_COMPATIBILITY_VERSION",
+ this->CreateString(vso.str().c_str()));
+ }
}
//----------------------------------------------------------------------------