[CMake] Various problems deploying a python module
Janosch Peters
jp at binford3000.de
Sat Jun 19 06:31:28 EDT 2010
On 2010-06-18 08:29:25 +0200, Michael Hertling said:
> On 06/17/2010 04:23 PM, Janosch Peters wrote:
>> I have two python frameworks on my mac: Python2.5 which comes with OS
>> X, and python2.6 from macports. If I just use
>> FIND_PACKAGE(PythonInterp) and FIND_PACKAGE(PythonLibs) I end up
>> getting the python2.6 interpreter from macports but the python2.5 libs
>> from OS X.
>
> Have you already tried variables like CMAKE_PREFIX_PATH et al. to
> direct the find functions to your preferred python installation?
I tried CMAKE_PREFIX_PATH and also CMAKE_FRAMEWORK_PATH but the
behaviour did not change. So I digged a bit into the modules code and
found out that the default macports framework prefix is already
recognized when looking for frameworks. However, as you can see in the
snippet below (it's from FindPythonLib), cmake just adds -framework
Python which apperantly defaults to the apple provided frameworks. It
seems to me that you cannot change that behaviour in any way, but by
changing the FindPythonLibs code. Correct me if Im wrong.
BTW, the macro CMAKE_FIND_FRAMEWORKS doesent care about
CMAKE_FRAMEWORK_PATH at all. I would consider that a bug.
I think the way to go would be to change CMAKE_FIND_FRAMEWORKS to make
it recognise CMAKE_FRAMEWORK_PATH and use the first framework found in
it to pass it to the "-frameworks" option and if none is found, just
default to the apple system framework.
For the time being, I think I have to stick to my (very ugly) solution.
cheers,
Janosch
============= Snippet from FindPythonLibs ==================
# Python Should be built and installed as a Framework on OSX
IF(Python_FRAMEWORKS)
# If a framework has been selected for the include path,
# make sure "-framework" is used to link it.
IF("${PYTHON_INCLUDE_DIR}" MATCHES "Python\\.framework")
SET(PYTHON_LIBRARY "")
SET(PYTHON_DEBUG_LIBRARY "")
ENDIF("${PYTHON_INCLUDE_DIR}" MATCHES "Python\\.framework")
IF(NOT PYTHON_LIBRARY)
SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python
Framework" FORCE)
ENDIF(NOT PYTHON_LIBRARY)
IF(NOT PYTHON_DEBUG_LIBRARY)
SET (PYTHON_DEBUG_LIBRARY "-framework Python" CACHE FILEPATH
"Python Framework" FORCE)
ENDIF(NOT PYTHON_DEBUG_LIBRARY)
ENDIF(Python_FRAMEWORKS)
More information about the CMake
mailing list