I am writing a C++ library which can be used from both C++ and Python on Mac and Linux. So I have decided to use CMake and SWIG for my project.
As well described in the SWIG 2.0 documentation, combination of SWIG and CMake also works fine on my Mac.
http://www.swig.org/Doc2.0/SWIGDocumentation.html#Introduction_build_system
But I have a question about make install.
After typing cmake . and make, _example.so was successfully generated. But make install does not work, because the auto-generated Makefile does not have install target. I would like to know how I can add install target in the Makefile. I would like _example.so to be installed under site-packages directory on each system.
I would very appreciate it if anyone could tell me how to modify the CMake example written in the above link.
The CMake interface to
make installis the CMake command install(). In your example, you could add an installation rule like this:Once there are any
install()commands in a CMakeList, CMake will generate aninstalltarget callable asmake install.