[CMake] Linking boost python with mingw

Christiaan Putter ceputter at googlemail.com
Mon Nov 12 17:03:10 EST 2007


Hi guys and girls,

I'm new to this wonderful CMake thingy and I'm having some problems linking
to boost.python.

My setup on windows xp:

mingw       5.1.3  (with gcc 3.4.5)
boost        1.34.1
python      2.5

I compiled boost as per instructions with mingw without any problems.

With some simple code using boost/python I can compile without errors, but
when ld tries linking I get "undefined reference to '_imp____  ...." errors.

In my CMakeLists file I have

TARGET_LINK_LIBRARIES(${EXE_NAME}
        ${BOOST_PYTHON_LIB}
        ${PYTHON_LIBRARIES}
    )

With the BOOST_PYTHON_LIB pointing directly to
C:/Boost/lib/libboost_python-mgw34-1_34_1.a

Removing code using boost.python stuff and just using the normal python lib
compiles and links fine.

What am I doing wrong?  I've tried every version of the boost_python lib by
the way, -mt, -s, -d, and combinations thereof.  Which one should I use, is
there a way to chose the correct library automatically, the
FindBoost.cmakeinclude doesn't seem to do it.

And what exactly is the -s library for? I though lib*.a files were already
static?

If anyone out there has gotten boost.python to work with mingw please let me
in on your secrets.  Any suggestions are welcome...

Have a nice day,
cputter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20071112/23143cdc/attachment.htm


More information about the CMake mailing list