Akira Okumura Akira Okumura - 1 year ago 249
Python Question

`make install` with CMake + SWIG + Python

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.

But I have a question about

make install

After typing
cmake .
was successfully generated. But
make install
does not work, because the auto-generated Makefile does not have
target. I would like to know how I can add
target in the Makefile. I would like
to be installed under
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.

Answer Source

The CMake interface to make install is the CMake command install(). In your example, you could add an installation rule like this:

  # ... add other arguments to install() as necessary

Once there are any install() commands in a CMakeList, CMake will generate an install target callable as make install.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download