[C++-sig] CMake and getting starting with boost.python
Yesterday I became a boost.python user, after years of heavy SWIG usage.
I would have started using boost.python years ago except for the bjam
learning curve. I spent hours TRYING on multiple occasions, but got lost
every time trying to get the page one example to build with bjam.
Here is how to build the "greet" example with a four line CMake file:
Re: [C++-sig] CMake and getting starting with boost.python
For those who prefer Makefiles, I found the following Makefile also worked
to build the greet example. It is based on some Makefiles posted to this
list. I don't know how robust it is. Worked under Linux Ubuntu 6.10.
On Friday 29 June 2007, Braddock Gaskill wrote:
> LINK_DIRECTORIES("/usr/lib/python2.5") # Not needed?
> ADD_LIBRARY(hello SHARED hello.cpp)
> You WILL have to `mv libhello.so hello.so` after building.
You can avoid renaming the shared object like this:
SET_TARGET_PROPERTIES(hello PROPERTIES PREFIX "")
This way the shared library won't have the "lib" prefix.
BTW, I'm using CMake + Boost.Python and I'm happy about it, the only issue I
have is that I can't compile it under Windows (MinGW) because of some
dllimport errors. Have you had any experience about it?