summaryrefslogtreecommitdiffstats
path: root/Modules/FindPython/Support.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-10-13 12:26:05 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-10-13 12:26:14 (GMT)
commitce6f9610b38a2dd14c45306ffb7b4a5bb6f748a3 (patch)
tree7d49eedd978ad73959cb214b5525d1c0de32cad2 /Modules/FindPython/Support.cmake
parent446874a8a1f5db0e552e39e123bd2405b7b9cbe6 (diff)
parent5772ca0a531c863874130b08611174274fe36037 (diff)
downloadCMake-ce6f9610b38a2dd14c45306ffb7b4a5bb6f748a3.zip
CMake-ce6f9610b38a2dd14c45306ffb7b4a5bb6f748a3.tar.gz
CMake-ce6f9610b38a2dd14c45306ffb7b4a5bb6f748a3.tar.bz2
Merge topic 'FindPython-Apple-python3' into release-3.19
5772ca0a53 FindPython: Ensure Apple Xcode python 3 is usable Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5356
Diffstat (limited to 'Modules/FindPython/Support.cmake')
-rw-r--r--Modules/FindPython/Support.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 41b55ee..7de2d29 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -2990,6 +2990,29 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
${_PYTHON_PREFIX}_PyPy_VERSION "${${_PYTHON_PREFIX}_PyPy_VERSION}")
endif()
+ unset(${_PYTHON_PREFIX}_LINK_OPTIONS)
+ if (${_PYTHON_PREFIX}_Development.Embed_FOUND AND APPLE
+ AND ${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$")
+ # rpath must be specified if python is part of a framework
+ unset(_${_PYTHON_PREFIX}_is_prefix)
+ foreach (_${_PYTHON_PREFIX}_implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ foreach (_${_PYTHON_PREFIX}_framework IN LISTS _${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_implementation}_FRAMEWORKS)
+ cmake_path (IS_PREFIX _${_PYTHON_PREFIX}_framework "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" _${_PYTHON_PREFIX}_is_prefix)
+ if (_${_PYTHON_PREFIX}_is_prefix)
+ cmake_path (GET _${_PYTHON_PREFIX}_framework PARENT_PATH _${_PYTHON_PREFIX}_framework)
+ set (${_PYTHON_PREFIX}_LINK_OPTIONS "LINKER:-rpath,${_${_PYTHON_PREFIX}_framework}")
+ break()
+ endif()
+ endforeach()
+ if (_${_PYTHON_PREFIX}_is_prefix)
+ break()
+ endif()
+ endforeach()
+ unset(_${_PYTHON_PREFIX}_implementation)
+ unset(_${_PYTHON_PREFIX}_framework)
+ unset(_${_PYTHON_PREFIX}_is_prefix)
+ endif()
+
if (NOT DEFINED ${_PYTHON_PREFIX}_SOABI)
_python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
endif()
@@ -3202,6 +3225,11 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
PROPERTY INTERFACE_LINK_LIBRARIES ${_${_PYTHON_PREFIX}_LINK_LIBRARIES})
endif()
endif()
+
+ if (${_PYTHON_PREFIX}_LINK_OPTIONS
+ AND _${_PYTHON_PREFIX}_LIBRARY_TYPE STREQUAL "SHARED")
+ set_property (TARGET ${__name} PROPERTY INTERFACE_LINK_OPTIONS "${${_PYTHON_PREFIX}_LINK_OPTIONS}")
+ endif()
endmacro()
if (${_PYTHON_PREFIX}_Development.Embed_FOUND)