Skip to content

Commit 4992b52

Browse files
committed
Merge #74: Add install-lib and install-bin build targets
fa130db Add `install-bin` target (Hennadii Stepanov) c4d26d2 Add `install-lib` target (Hennadii Stepanov) bc3d166 Install `proxy.capnp` with `mpgen` target (Hennadii Stepanov) Pull request description: This PR adds new `install-lib` and `install-bin` build targets which allow to build and install only required artifacts during different stages of cross-building. A demo, which uses this branch in Bitcoin Core, is [here](https://github.com/hebasto/bitcoin/commits/220907-mp-demo). ACKs for top commit: ryanofsky: Code review ACK fa130db. This does exactly what I'd expect now, so will merge it. But you do bring up an important point about no longer exporting cmake targets. Tree-SHA512: 2146913594c2ad4570ac4fb77d09297bb0ddcd0c8cd38527db0cfc04b98d099a0e6c97e7b4cbed64f78da6ba7c98bdafa20c4c9cc20db1da3d57dadee7c88899
2 parents f85feff + fa130db commit 4992b52

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

CMakeLists.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ set(MP_PUBLIC_HEADERS
5858
${MP_PROXY_HDRS}
5959
include/mp/proxy-io.h
6060
include/mp/proxy-types.h
61-
include/mp/proxy.capnp
6261
include/mp/proxy.h
6362
include/mp/util.h)
6463

@@ -78,7 +77,15 @@ target_link_libraries(multiprocess PRIVATE CapnProto::kj)
7877
target_link_libraries(multiprocess PRIVATE CapnProto::kj-async)
7978
set_target_properties(multiprocess PROPERTIES
8079
PUBLIC_HEADER "${MP_PUBLIC_HEADERS}")
81-
install(TARGETS multiprocess EXPORT Multiprocess ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include/mp)
80+
install(TARGETS multiprocess EXPORT Multiprocess
81+
ARCHIVE DESTINATION lib COMPONENT lib
82+
PUBLIC_HEADER DESTINATION include/mp COMPONENT lib)
83+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libmultiprocess.pc"
84+
DESTINATION "lib/pkgconfig" COMPONENT lib)
85+
add_custom_target(install-lib
86+
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=lib -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake
87+
VERBATIM)
88+
add_dependencies(install-lib multiprocess)
8289

8390
add_executable(mpgen src/mp/gen.cpp $<TARGET_OBJECTS:util>)
8491
target_include_directories(mpgen PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>)
@@ -90,12 +97,20 @@ target_link_libraries(mpgen PRIVATE CapnProto::kj)
9097
target_link_libraries(mpgen PRIVATE Threads::Threads)
9198
set_target_properties(mpgen PROPERTIES
9299
INSTALL_RPATH_USE_LINK_PATH TRUE)
93-
install(TARGETS mpgen EXPORT Multiprocess RUNTIME DESTINATION bin)
100+
set_target_properties(mpgen PROPERTIES
101+
PUBLIC_HEADER include/mp/proxy.capnp)
102+
install(TARGETS mpgen EXPORT Multiprocess
103+
RUNTIME DESTINATION bin COMPONENT bin
104+
PUBLIC_HEADER DESTINATION include/mp COMPONENT bin)
105+
install(FILES "include/mpgen.mk"
106+
DESTINATION "include" COMPONENT bin)
107+
add_custom_target(install-bin
108+
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=bin -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake
109+
VERBATIM)
110+
add_dependencies(install-bin mpgen)
94111

95112
configure_file(include/mp/config.h.in "${CMAKE_CURRENT_BINARY_DIR}/include/mp/config.h")
96113
configure_file(pkgconfig/libmultiprocess.pc.in "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libmultiprocess.pc" @ONLY)
97-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libmultiprocess.pc" DESTINATION "lib/pkgconfig")
98-
install(FILES "include/mpgen.mk" DESTINATION "include")
99114

100115
install(EXPORT Multiprocess DESTINATION lib/cmake/Multiprocess)
101116

0 commit comments

Comments
 (0)