python: finding specific library version via CMake

Ryan Schmidt ryandesign at macports.org
Tue Jun 23 14:04:39 PDT 2015


On Jun 22, 2015, at 4:01 PM, René J.V. Bertin wrote:

> I have a CMake file that has the following, hopefully self-explanatory, bit:
> 
> {{{
> find_package(PythonLibs 3.4.3 REQUIRED)
> if ( NOT ${PYTHONLIBS_FOUND} OR ${PYTHON_VERSION_MINOR} GREATER 4 )
>    message(FATAL_ERROR "Python 3.4.3 with --enable-shared is required")
> endif()
> }}}
> 
> The only thing that did was picking up an old 2.4.3 (!) framework I'd installed as /Library/Frameworks/Python2.4.framework; after removing that it finds nothing at all.
> I had a comparable issue with `find_package(PythonInterp 3.0 required)` which I could resolve by hardcoding the PYTHON_EXECUTABLE variable, but I don't think one can pull a similar trick with the PythonLibs script.
> 
> Is there a clean way out, I'm surely not the first one to try this?

My impression is that cmake is horrible at many things, including finding dependencies, and that you're best off bypassing automatic dependency finding by specifying the absolute path to every dependency, using whatever configure args the project provides for that.




More information about the macports-dev mailing list