From bc3d166d3724b6200380c50006d69912282285b3 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 8 Sep 2022 01:22:20 +0200 Subject: [PATCH 1/3] Install `proxy.capnp` with `mpgen` target This changes is required for the following two commits. --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee6d73f6..dfd06b8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,6 @@ set(MP_PUBLIC_HEADERS ${MP_PROXY_HDRS} include/mp/proxy-io.h include/mp/proxy-types.h - include/mp/proxy.capnp include/mp/proxy.h include/mp/util.h) @@ -90,7 +89,9 @@ target_link_libraries(mpgen PRIVATE CapnProto::kj) target_link_libraries(mpgen PRIVATE Threads::Threads) set_target_properties(mpgen PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) -install(TARGETS mpgen EXPORT Multiprocess RUNTIME DESTINATION bin) +set_target_properties(mpgen PROPERTIES + PUBLIC_HEADER include/mp/proxy.capnp) +install(TARGETS mpgen EXPORT Multiprocess RUNTIME DESTINATION bin PUBLIC_HEADER DESTINATION include/mp) configure_file(include/mp/config.h.in "${CMAKE_CURRENT_BINARY_DIR}/include/mp/config.h") configure_file(pkgconfig/libmultiprocess.pc.in "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libmultiprocess.pc" @ONLY) From c4d26d2ddb12e5d5e2bf005950b0df8512a337f9 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 9 Sep 2022 10:14:24 +0200 Subject: [PATCH 2/3] Add `install-lib` target When cross building, using `make install-lib` allows to avoid unneeded building of `mpgen` for a target system. --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfd06b8c..7c7265a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,15 @@ target_link_libraries(multiprocess PRIVATE CapnProto::kj) target_link_libraries(multiprocess PRIVATE CapnProto::kj-async) set_target_properties(multiprocess PROPERTIES PUBLIC_HEADER "${MP_PUBLIC_HEADERS}") -install(TARGETS multiprocess EXPORT Multiprocess ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include/mp) +install(TARGETS multiprocess EXPORT Multiprocess + ARCHIVE DESTINATION lib COMPONENT lib + PUBLIC_HEADER DESTINATION include/mp COMPONENT lib) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libmultiprocess.pc" + DESTINATION "lib/pkgconfig" COMPONENT lib) +add_custom_target(install-lib + COMMAND ${CMAKE_COMMAND} -DCOMPONENT=lib -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake + VERBATIM) +add_dependencies(install-lib multiprocess) add_executable(mpgen src/mp/gen.cpp $) target_include_directories(mpgen PRIVATE $) @@ -95,7 +103,6 @@ install(TARGETS mpgen EXPORT Multiprocess RUNTIME DESTINATION bin PUBLIC_HEADER configure_file(include/mp/config.h.in "${CMAKE_CURRENT_BINARY_DIR}/include/mp/config.h") configure_file(pkgconfig/libmultiprocess.pc.in "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libmultiprocess.pc" @ONLY) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libmultiprocess.pc" DESTINATION "lib/pkgconfig") install(FILES "include/mpgen.mk" DESTINATION "include") install(EXPORT Multiprocess DESTINATION lib/cmake/Multiprocess) From fa130db398ef12752e976468eb12ad36dfd49b99 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 9 Sep 2022 09:56:46 +0200 Subject: [PATCH 3/3] Add `install-bin` target When cross building, using `make install-bin` allows to avoid unneeded building of `libmultiprocess` for a build system. --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c7265a2..4247c4b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,11 +99,18 @@ set_target_properties(mpgen PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) set_target_properties(mpgen PROPERTIES PUBLIC_HEADER include/mp/proxy.capnp) -install(TARGETS mpgen EXPORT Multiprocess RUNTIME DESTINATION bin PUBLIC_HEADER DESTINATION include/mp) +install(TARGETS mpgen EXPORT Multiprocess + RUNTIME DESTINATION bin COMPONENT bin + PUBLIC_HEADER DESTINATION include/mp COMPONENT bin) +install(FILES "include/mpgen.mk" + DESTINATION "include" COMPONENT bin) +add_custom_target(install-bin + COMMAND ${CMAKE_COMMAND} -DCOMPONENT=bin -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake + VERBATIM) +add_dependencies(install-bin mpgen) configure_file(include/mp/config.h.in "${CMAKE_CURRENT_BINARY_DIR}/include/mp/config.h") configure_file(pkgconfig/libmultiprocess.pc.in "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libmultiprocess.pc" @ONLY) -install(FILES "include/mpgen.mk" DESTINATION "include") install(EXPORT Multiprocess DESTINATION lib/cmake/Multiprocess)