cmake: Fix linker errors on Darwin when using external dependencies (#10467)

Adds upstream patch for a missing framework. This is anticipated
to be fixed by CMake 3.13.4 so is only applied up to version 3.13.3
This commit is contained in:
Chuck Atkins 2019-01-30 21:24:20 -05:00 committed by Peter Scheibel
parent 2b6bf06150
commit be38fded9b
2 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,28 @@
commit 475e78d9071b34690617a85853433a9fc15da057
Author: Chuck Atkins <chuck.atkins@kitware.com>
Date: Mon Jan 28 16:28:28 2019 -0500
macOS: Add missing explicit dependency on CoreServices framework
On Apple, the implementation of cmGlobalXCodeGenerator::Open uses
LSOpenCFURLRef from CoreServices. This get's transitively pulled in
from CMake's libuv build but ends up generating a linker error when
using an external libuv. This explicitly adds the appropriate
dependency.
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 311f3f4e56..8aff8f6b2f 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -791,9 +791,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc"
endif()
endif()
-# On Apple we need CoreFoundation
+# On Apple we need CoreFoundation and CoreServices
if(APPLE)
target_link_libraries(CMakeLib "-framework CoreFoundation")
+ target_link_libraries(CMakeLib "-framework CoreServices")
endif()
if(WIN32 AND NOT UNIX)

View file

@ -11,6 +11,7 @@ class Cmake(Package):
tools designed to build, test and package software."""
homepage = 'https://www.cmake.org'
url = 'https://github.com/Kitware/CMake/releases/download/v3.13.0/cmake-3.13.0.tar.gz'
maintainers = ['chuckatkins']
version('3.13.3', '665f905036b1f731a2a16f83fb298b1fb9d0f98c382625d023097151ad016b25')
version('3.13.2', 'c925e7d2c5ba511a69f43543ed7b4182a7d446c274c7480d0e42cd933076ae25')
@ -50,6 +51,10 @@ class Cmake(Package):
version('3.0.2', 'db4c687a31444a929d2fdc36c4dfb95f')
version('2.8.10.2', '097278785da7182ec0aea8769d06860c')
# Fix linker error when using external libs on darwin.
# See https://gitlab.kitware.com/cmake/cmake/merge_requests/2873
patch('cmake-macos-add-coreservices.patch', when='@3.11.0:3.13.3')
variant('ownlibs', default=False, description='Use CMake-provided third-party libraries')
variant('qt', default=False, description='Enables the build of cmake-gui')
variant('doc', default=False, description='Enables the generation of html and man page documentation')