[Cmake-commits] CMake branch, next, updated. v2.8.11-2221-g82bebd2
Clinton Stimpson
clinton at elemtech.com
Mon May 27 11:33:52 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 82bebd2a8949fc59b1bb9f2f4c1e79f7d2807f5d (commit)
via a060f29f5d1a715c7db068305a81bea8e7b509ca (commit)
from 13f3a6698027c85a942751841da2a75b865dd4d3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82bebd2a8949fc59b1bb9f2f4c1e79f7d2807f5d
commit 82bebd2a8949fc59b1bb9f2f4c1e79f7d2807f5d
Merge: 13f3a66 a060f29
Author: Clinton Stimpson <clinton at elemtech.com>
AuthorDate: Mon May 27 11:33:46 2013 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon May 27 11:33:46 2013 -0400
Merge topic 'xcode-shlib-versioning' into next
a060f29 xcode: Add support for shared library versioning.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a060f29f5d1a715c7db068305a81bea8e7b509ca
commit a060f29f5d1a715c7db068305a81bea8e7b509ca
Author: Clinton Stimpson <clinton at elemtech.com>
AuthorDate: Mon May 13 20:45:35 2013 -0600
Commit: Clinton Stimpson <clinton at elemtech.com>
CommitDate: Mon May 27 09:32:52 2013 -0600
xcode: Add support for shared library versioning.
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 2e6b71e..6e5d449 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -207,12 +207,8 @@ if("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")
"${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress")
endif()
-if(NOT XCODE)
- # Enable shared library versioning. This flag is not actually referenced
- # but the fact that the setting exists will cause the generators to support
- # soname computation.
- set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
-endif()
+# Enable shared library versioning.
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
# Xcode does not support -isystem yet.
if(XCODE)
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 240d60c..43d49da 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1319,8 +1319,40 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
= cmtarget.GetPreBuildCommands();
std::vector<cmCustomCommand> const & prelink
= cmtarget.GetPreLinkCommands();
- std::vector<cmCustomCommand> const & postbuild
+ std::vector<cmCustomCommand> postbuild
= cmtarget.GetPostBuildCommands();
+
+ if(cmtarget.GetType() == cmTarget::SHARED_LIBRARY &&
+ !cmtarget.IsFrameworkOnApple())
+ {
+ cmCustomCommandLines cmd;
+ cmd.resize(1);
+ cmd[0].push_back(this->CurrentMakefile->GetDefinition("CMAKE_COMMAND"));
+ cmd[0].push_back("-E");
+ cmd[0].push_back("cmake_symlink_library");
+ std::string str_file = "$<TARGET_FILE:";
+ str_file += cmtarget.GetName();
+ str_file += ">";
+ std::string str_so_file = "$<TARGET_SONAME_FILE:";
+ str_so_file += cmtarget.GetName();
+ str_so_file += ">";
+ std::string str_link_file = "$<TARGET_LINKER_FILE:";
+ str_link_file += cmtarget.GetName();
+ str_link_file += ">";
+ cmd[0].push_back(str_file);
+ cmd[0].push_back(str_so_file);
+ cmd[0].push_back(str_link_file);
+
+ cmCustomCommand command(this->CurrentMakefile,
+ std::vector<std::string>(),
+ std::vector<std::string>(),
+ cmd,
+ "Creating symlinks",
+ "");
+
+ postbuild.push_back(command);
+ }
+
std::vector<cmSourceFile*>const &classes = cmtarget.GetSourceFiles();
// add all the sources
std::vector<cmCustomCommand> commands;
@@ -1797,9 +1829,34 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string pnprefix;
std::string pnbase;
std::string pnsuffix;
-
target.GetFullNameComponents(pnprefix, pnbase, pnsuffix, configName);
+ const char* version = target.GetProperty("VERSION");
+ const char* soversion = target.GetProperty("SOVERSION");
+ if(!target.HasSOName(configName) || target.IsFrameworkOnApple())
+ {
+ version = 0;
+ soversion = 0;
+ }
+ if(version && !soversion)
+ {
+ soversion = version;
+ }
+ if(!version && soversion)
+ {
+ version = soversion;
+ }
+
+ std::string realName = pnbase;
+ std::string soName = pnbase;
+ if(version && soversion)
+ {
+ realName += ".";
+ realName += version;
+ soName += ".";
+ soName += soversion;
+ }
+
// Set attributes to specify the proper name for the target.
std::string pndir = this->CurrentMakefile->GetCurrentOutputDirectory();
if(target.GetType() == cmTarget::STATIC_LIBRARY ||
@@ -1857,7 +1914,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// Store the product name for all target types.
buildSettings->AddAttribute("PRODUCT_NAME",
- this->CreateString(pnbase.c_str()));
+ this->CreateString(realName.c_str()));
buildSettings->AddAttribute("SYMROOT",
this->CreateString(pndir.c_str()));
@@ -1935,9 +1992,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
if(target.GetPropertyAsBool("FRAMEWORK"))
{
- std::string version = target.GetFrameworkVersion();
+ std::string fw_version = target.GetFrameworkVersion();
buildSettings->AddAttribute("FRAMEWORK_VERSION",
- this->CreateString(version.c_str()));
+ this->CreateString(fw_version.c_str()));
std::string plist = this->ComputeInfoPListLocation(target);
// Xcode will create the final version of Info.plist at build time,
@@ -2162,20 +2219,21 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
// Get the install_name directory for the build tree.
install_name_dir = target.GetInstallNameDirForBuildTree(configName);
- if(install_name_dir.empty())
- {
- // Xcode will not pass the -install_name option at all if INSTALL_PATH
- // is not given or is empty. We must explicitly put the flag in the
- // link flags to create an install_name with just the library soname.
- extraLinkOptions += " -install_name ";
- extraLinkOptions += target.GetSOName(configName);
- }
- else
+ // Xcode doesn't create the correct install_name in some cases.
+ // That is, if the INSTALL_PATH is empty, or if we have versioning
+ // of dylib libraries, we want to specify the install_name.
+ // This is done by adding a link flag to create an install_name
+ // with just the library soname.
+ extraLinkOptions += " -install_name ";
+ if(!install_name_dir.empty())
{
// Convert to a path for the native build tool.
cmSystemTools::ConvertToUnixSlashes(install_name_dir);
// do not escape spaces on this since it is only a single path
+ extraLinkOptions += install_name_dir;
+ extraLinkOptions += "/";
}
+ extraLinkOptions += target.GetSOName(configName);
}
buildSettings->AddAttribute("INSTALL_PATH",
this->CreateString(install_name_dir.c_str()));
-----------------------------------------------------------------------
Summary of changes:
Modules/Platform/Darwin.cmake | 8 +---
Source/cmGlobalXCodeGenerator.cxx | 86 +++++++++++++++++++++++++++++++------
2 files changed, 74 insertions(+), 20 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list