2 # This module finds if Python is installed and determines where the
3 # include files and libraries are. It also determines what the name of
4 # the library is. This code sets the following variables:
6 # PYTHON_LIBRARIES = the full path to the library found
7 # PYTHON_INCLUDE_PATH = the path to where Python.h can be found
8 # PYTHON_DEBUG_LIBRARIES = the full path to the debug library found
11 INCLUDE(CMakeFindFrameworks)
14 FIND_LIBRARY(PYTHON_DEBUG_LIBRARY
15 NAMES python24_d python23_d python22_d python21_d python20_d python
17 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs/Debug
18 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs
19 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs/Debug
20 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs
21 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs/Debug
22 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs
23 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs/Debug
24 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs
25 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs/Debug
26 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs
27 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/libs/Debug
28 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/libs
29 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs/Debug
30 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs
34 FIND_LIBRARY(PYTHON_LIBRARY
35 NAMES python24 python2.4 python2.4.dll
36 python23 python2.3 python2.3.dll
37 python22 python2.2 python2.2.dll
38 python21 python2.1 python2.1.dll
39 python20 python2.0 python2.0.dll
40 python16 python1.6 python1.6.dll
41 python15 python1.5 python1.5.dll
43 /usr/lib/python2.4/config
44 /usr/lib/python2.3/config
45 /usr/lib/python2.2/config
46 /usr/lib/python2.1/config
47 /usr/lib/python2.0/config
48 /usr/lib/python1.6/config
49 /usr/lib/python1.5/config
52 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs
53 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs
54 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs
55 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs
56 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs
57 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/libs
58 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs
61 # Search for the python framework on Apple.
62 CMAKE_FIND_FRAMEWORKS(Python)
63 SET(PYTHON_FRAMEWORK_INCLUDES)
65 IF(NOT PYTHON_INCLUDE_PATH)
66 FOREACH(version 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
67 FOREACH(dir ${Python_FRAMEWORKS})
68 SET(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES}
69 ${dir}/Versions/${version}/include/python${version})
72 ENDIF(NOT PYTHON_INCLUDE_PATH)
73 ENDIF(Python_FRAMEWORKS)
75 FIND_PATH(PYTHON_INCLUDE_PATH Python.h
76 ${PYTHON_FRAMEWORK_INCLUDES}
77 /usr/include/python2.4
78 /usr/include/python2.3
79 /usr/include/python2.2
80 /usr/include/python2.1
81 /usr/include/python2.0
82 /usr/include/python1.6
83 /usr/include/python1.5
86 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/include
87 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/include
88 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/include
89 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/include
90 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/include
91 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/include
92 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/include
103 # Python Should be built and installed as a Framework on OSX
104 IF(Python_FRAMEWORKS)
105 # If a framework has been selected for the include path,
106 # make sure "-framework" is used to link it.
107 IF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
108 SET(PYTHON_LIBRARY "")
109 SET(PYTHON_DEBUG_LIBRARY "")
110 ENDIF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
111 IF(NOT PYTHON_LIBRARY)
112 SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
113 ENDIF(NOT PYTHON_LIBRARY)
114 IF(NOT PYTHON_DEBUG_LIBRARY)
115 SET (PYTHON_DEBUG_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
116 ENDIF(NOT PYTHON_DEBUG_LIBRARY)
117 ENDIF(Python_FRAMEWORKS)
119 # We use PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the cache entries
120 # because they are meant to specify the location of a single library.
121 # We now set the variables listed by the documentation for this
123 SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
124 SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")