[CMake] Finding the correct Python framework with cmake
Bill Hoffman
bill.hoffman at kitware.com
Wed Nov 11 18:08:58 EST 2009
Jed Brown wrote:
> Mark Moll wrote:
>
>> Add "-F /opt/local/Library/Frameworks" to your compilation flags or
>> add this line to your .bash_profile:
>>
You should never add the -F to the CMake flags, just use the full path
to the framework dir in either an include or a link library and CMake
will add the -F -f for you.
>> export DYLD_FRAMEWORK_PATH=/opt/local/Library/Frameworks
>
> It seems to me that the only acceptable solution is that
> FindPythonInterp.cmake and FindPythonLibs.cmake consult some
> non-advanced cache variable (and possibly also environment) to find a
> consistent Python. PYTHON_EXECUTABLE seems like a natural candidate.
>
> Expecting users (or every developer that wants to use python portably)
> to take responsibility for this is a cop-out.
>
Seems that FindPythonLibs.cmake is using some really old style mac stuff...
# 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)
CMake knows how to handle frameworks, so if you have a .framework in the
include dirs cmake will add -F -f flags in the correct places, same goes
for link libraries. Seems that we do not yet have a python module
maintainer...
http://www.cmake.org/Wiki/CMake:Module_Maintainers
Any volunteers?
-Bill
More information about the CMake
mailing list