[CMake] Finding the correct Python framework with cmake

Mark Moll mmoll at cs.rice.edu
Wed Nov 11 17:34:35 EST 2009


Add "-F /opt/local/Library/Frameworks” to your compilation flags or add this line to your .bash_profile:

export DYLD_FRAMEWORK_PATH=/opt/local/Library/Frameworks


On Nov 11, 2009, at 4:15 PM, Celil Rufat wrote:

> I am using the macports version of python on a Snow Leopard computer, and using cmake to build a cross-platform extension to it.
> 
> include(FindPythonInterp)
> 
> include
> (FindPythonLibs  )
> 
> However, while cmake identified the correct interpreter in /opt/local/bin, it tries to link against the wrong framework - namely the system Python framework. 
> -- Found PythonInterp: /opt/local/bin/python2.6
> 
> -- Found PythonLibs: -framework Python
> 
> And this causes the following runtime error
> 
> Fatal Python error: Interpreter not initialized (version mismatch?)
> 
> As soon as I replace -framework Python with /opt/local/Library/Frameworks/Python.framework/Python things seem to work as expected.
> 
> How can I make cmake link against the correct Python framework found in
> 
> /opt/local/Library/Frameworks/Python.framework/Python
> 
> rather than the system one in
> 
> /System/Library/Frameworks/Python.framework/Python
> 
> ?
> 
> This question has also been posted on StackOverflow:
> http://stackoverflow.com/questions/1718251/finding-the-correct-python-framework-with-cmake
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

-- 
Mark





More information about the CMake mailing list