I'm interfacing a C++ library with the ever more popular pybind11 to get native Python bindings; configuration is via CMake
.
My CMakeLists.txt
looks like
cmake_minimum_required(VERSION 3.0)
project(foo)
FILE(GLOB foo_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
FIND_PACKAGE(pybind11 REQUIRED)
pybind11_add_module(mylib ${foo_SRCS})
This doesn't seem to register installation rules, however. Hence, while everything works as expected in the build tree, make install
doesn't do anything.
What needs to be added to get the installation in order?
Just the usual CMake install commands:
include(GNUInstallDirs)
install(TARGETS mylib
COMPONENT python
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
for Unix. You can manually make up the destination directories for other platforms. The "COMPONENT" part is optional, but just neater for different types of installers.