Commit e6565437 authored by Branislav Katreniak's avatar Branislav Katreniak

cmake: add library aliases as find-package finds them

This allows to consumers to use the same targets regardless
whether capnproto CMakeList.txt is added as subdirectory
or whether capnproto is found as package
parent a290d13a
...@@ -56,6 +56,7 @@ set(capnp_schemas ...@@ -56,6 +56,7 @@ set(capnp_schemas
schema.capnp schema.capnp
) )
add_library(capnp ${capnp_sources}) add_library(capnp ${capnp_sources})
add_library(CapnProto::capnp ALIAS capnp)
target_link_libraries(capnp kj) target_link_libraries(capnp kj)
#make sure external consumers don't need to manually set the include dirs #make sure external consumers don't need to manually set the include dirs
target_include_directories(capnp INTERFACE target_include_directories(capnp INTERFACE
...@@ -93,6 +94,7 @@ set(capnp-rpc_schemas ...@@ -93,6 +94,7 @@ set(capnp-rpc_schemas
) )
if(NOT CAPNP_LITE) if(NOT CAPNP_LITE)
add_library(capnp-rpc ${capnp-rpc_sources}) add_library(capnp-rpc ${capnp-rpc_sources})
add_library(CapnProto::capnp-rpc ALIAS capnp-rpc)
target_link_libraries(capnp-rpc capnp kj-async kj) target_link_libraries(capnp-rpc capnp kj-async kj)
install(TARGETS capnp-rpc ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS capnp-rpc ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES ${capnp-rpc_headers} ${capnp-rpc_schemas} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/capnp") install(FILES ${capnp-rpc_headers} ${capnp-rpc_schemas} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/capnp")
...@@ -113,6 +115,7 @@ set(capnp-json_schemas ...@@ -113,6 +115,7 @@ set(capnp-json_schemas
) )
if(NOT CAPNP_LITE) if(NOT CAPNP_LITE)
add_library(capnp-json ${capnp-json_sources}) add_library(capnp-json ${capnp-json_sources})
add_library(CapnProto::capnp-json ALIAS capnp-json)
target_link_libraries(capnp-json capnp kj-async kj) target_link_libraries(capnp-json capnp kj-async kj)
install(TARGETS capnp-json ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS capnp-json ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES ${capnp-json_headers} ${capnp-json_schemas} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/capnp/compat") install(FILES ${capnp-json_headers} ${capnp-json_schemas} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/capnp/compat")
......
...@@ -57,6 +57,7 @@ set(kj-std_headers ...@@ -57,6 +57,7 @@ set(kj-std_headers
std/iostream.h std/iostream.h
) )
add_library(kj ${kj_sources}) add_library(kj ${kj_sources})
add_library(CapnProto::kj ALIAS kj)
if(UNIX) if(UNIX)
target_link_libraries(kj PUBLIC pthread) target_link_libraries(kj PUBLIC pthread)
endif() endif()
...@@ -82,6 +83,7 @@ set(kj-test-compat_headers ...@@ -82,6 +83,7 @@ set(kj-test-compat_headers
compat/gtest.h compat/gtest.h
) )
add_library(kj-test ${kj-test_sources}) add_library(kj-test ${kj-test_sources})
add_library(CapnProto::kj-test ALIAS kj-test)
target_link_libraries(kj-test kj) target_link_libraries(kj-test kj)
install(TARGETS kj-test ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kj-test ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES ${kj-test_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/kj") install(FILES ${kj-test_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/kj")
...@@ -103,6 +105,7 @@ set(kj-async_headers ...@@ -103,6 +105,7 @@ set(kj-async_headers
) )
if(NOT CAPNP_LITE) if(NOT CAPNP_LITE)
add_library(kj-async ${kj-async_sources}) add_library(kj-async ${kj-async_sources})
add_library(CapnProto::kj-async ALIAS kj-async)
target_link_libraries(kj-async kj) target_link_libraries(kj-async kj)
if(UNIX) if(UNIX)
# external clients of this library need to link to pthreads # external clients of this library need to link to pthreads
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment