diff options
author | Brad King <brad.king@kitware.com> | 2008-07-09 14:09:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-07-09 14:09:46 (GMT) |
commit | 0d54001276a3123e35e20ee7240cdeffe401e7af (patch) | |
tree | 828cabfa28cb3dd6e02812502b1615a5d54fbf8b /Source/cmGlobalXCodeGenerator.cxx | |
parent | da4f142cc12cf603f7d34562d558c0ed7bd65d5f (diff) | |
download | CMake-0d54001276a3123e35e20ee7240cdeffe401e7af.zip CMake-0d54001276a3123e35e20ee7240cdeffe401e7af.tar.gz CMake-0d54001276a3123e35e20ee7240cdeffe401e7af.tar.bz2 |
ENH: Set version info for shared libs on OSX.
- Map SOVERSION major.minor.patch to compatibility_version
- Map VERSION major.minor.patch to current_version
- See issue #4383.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 36 |
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())); + } } //---------------------------------------------------------------------------- |