cmake/Python problem

Hi Jon,

I've run into an issue with the CMake setup for python-broccoli and
pysubnetree. The problem occurs on a machine that has Python 2.4
installed system-wide, but where I have installed a self-compiled 2.6
into my home. CMake does detect the 2.6 binary correctly (it's in the
PATH), but its PythonLibs still goes for the 2.4 libraries.

I think the underlying problem is that PythonLibs searches for the
libraries itself, while it should better ask the "python-config" that
corresponds to what PythonInterp found.

I'm attaching a patch that runs python-config and then adapts
CMAKE_LIBRARY_PATH accordingly before it does PythonLibs. Patching
both python-broccoli and pysubnettree with this solves my problem.
However, I'm not sure this is indeed the cleanest way of doing it.

Could you take a look?

Thanks,

Robin

And now the attachment. :slight_smile:

Robin

diff (1.15 KB)

I think the underlying problem is that PythonLibs searches for the
libraries itself, while it should better ask the "python-config" that
corresponds to what PythonInterp found.

I didn't look at the patch but I agree this is the right way to do this.

    Craig

Grmpf. Now the the *right* attachment.

Robin

patch (728 Bytes)

Grmpf. Now the the *right* attachment.

Seems like a good method to use (I didn't see any innate/obvious way to get FindPythonLibs.cmake to be aware of the result from FindPythonInterp.cmake).

The patch seems to add two "${PYTHON_PREFIX}/lib" paths, though, which I don't understand:

    set(CMAKE_LIBRARY_PATH ${PYTHON_PREFIX}/lib ${PYTHON_PREFIX}/lib ${CMAKE_LIBRARY_PATH})

Is that just a typo?

- Jon

Yes and no. I was wondering whether I need to add both lib64 and lib,
and seems I didn't make up my mind. :slight_smile: But I guess it should have
both.

Ok, I'll go ahead and commit this.

Thanks,

Robin