From 7b28fbd6561285ef0eb4a9a1bcb857c7cb5adad3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 26 Oct 2009 10:05:46 -0400 Subject: [PATCH] Fix Xcode dylib version default The commit "Set version info for shared libs on OSX" taught the Xcode generator to honor VERSION and SOVERSION properties. However, it also set version '1.0.0' as the default when no version property is set, which is inconsistent with the Makefiles generator. This commit fixes the default to '0.0.0' for consistency. See issue #9773. --- Source/cmGlobalXCodeGenerator.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e46521bfa..e0d6b5d77 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1865,25 +1865,25 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, // 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; + + // Xcode always wants at least 1.0.0 or nothing + if(!(major == 0 && minor == 0 && patch == 0)) + { + 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; + + // Xcode always wants at least 1.0.0 or nothing + if(!(major == 0 && minor == 0 && patch == 0)) + { + vso << major << "." << minor << "." << patch; + } buildSettings->AddAttribute("DYLIB_COMPATIBILITY_VERSION", this->CreateString(vso.str().c_str())); }