@@ -31,6 +31,19 @@ if(EXISTS PYTHON_LIBRARY)
31
31
set (PYTHONLIBRARY_FOUND TRUE )
32
32
else (EXISTS PYTHON_LIBRARY )
33
33
34
+ set (_custom_python_fw FALSE )
35
+ if (APPLE AND PYTHON_CUSTOM_FRAMEWORK )
36
+ if ("${PYTHON_CUSTOM_FRAMEWORK} " MATCHES "Python\\ .framework" )
37
+ STRING (REGEX REPLACE "(.*Python\\ .framework).*$" "\\ 1" _python_fw "${PYTHON_CUSTOM_FRAMEWORK} " )
38
+ set (PYTHON_EXECUTABLE "${_python_fw} /Versions/Current/bin/python" )
39
+ set (PYTHON_INCLUDE_PATH "${_python_fw} /Versions/Current/Headers" )
40
+ set (PYTHON_LIBRARY "${_python_fw} /Versions/Current/Python" )
41
+ if (EXISTS "${PYTHON_EXECUTABLE} " AND EXISTS "${PYTHON_INCLUDE_PATH} " AND EXISTS "${PYTHON_LIBRARY} " )
42
+ set (_custom_python_fw TRUE )
43
+ endif ()
44
+ endif ("${PYTHON_CUSTOM_FRAMEWORK} " MATCHES "Python\\ .framework" )
45
+ endif (APPLE AND PYTHON_CUSTOM_FRAMEWORK )
46
+
34
47
FIND_PACKAGE (PythonInterp )
35
48
36
49
if (PYTHONINTERP_FOUND )
@@ -60,7 +73,7 @@ else(EXISTS PYTHON_LIBRARY)
60
73
endif (python_config )
61
74
62
75
# adapted from cmake's builtin FindPythonLibs
63
- if (APPLE )
76
+ if (APPLE AND NOT _custom_python_fw )
64
77
CMAKE_FIND_FRAMEWORKS (Python )
65
78
set (PYTHON_FRAMEWORK_INCLUDES )
66
79
if (Python_FRAMEWORKS )
@@ -75,7 +88,7 @@ else(EXISTS PYTHON_LIBRARY)
75
88
endif (NOT PYTHON_LIBRARY )
76
89
set (PYTHONLIBRARY_FOUND TRUE )
77
90
endif (Python_FRAMEWORKS )
78
- endif (APPLE )
91
+ endif (APPLE AND NOT _custom_python_fw )
79
92
endif (PYTHONINTERP_FOUND )
80
93
81
94
if (PYTHONLIBRARY_FOUND )
0 commit comments