Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

propagate options to cmake find_package #531

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions install/PackageConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

@PACKAGE_INIT@

set(ZENOHC_BUILD_WITH_UNSTABLE_API @ZENOHC_BUILD_WITH_UNSTABLE_API@)
set(ZENOHC_BUILD_WITH_SHARED_MEMORY @ZENOHC_BUILD_WITH_SHARED_MEMORY@)
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
Expand All @@ -24,6 +26,15 @@ if(_IMPORT_PREFIX STREQUAL "/")
endif()

add_library(__zenohc_static STATIC IMPORTED GLOBAL)
message(STATUS "ZENOHC_BUILD_WITH_UNSTABLE_API=${ZENOHC_BUILD_WITH_UNSTABLE_API}")
if(ZENOHC_BUILD_WITH_UNSTABLE_API)
target_compile_definitions(__zenohc_static INTERFACE UNSTABLE)
endif()
message(STATUS "ZENOHC_BUILD_WITH_SHARED_MEMORY=${ZENOHC_BUILD_WITH_SHARED_MEMORY}")
if(ZENOHC_BUILD_WITH_SHARED_MEMORY)
target_compile_definitions(__zenohc_static INTERFACE SHARED_MEMORY)
endif()

add_library(zenohc::static ALIAS __zenohc_static)
target_link_libraries(__zenohc_static INTERFACE @NATIVE_STATIC_LIBS@)
set_target_properties(__zenohc_static PROPERTIES
Expand All @@ -44,6 +55,13 @@ if(NOT ("@IMPLIB@" STREQUAL ""))
set_property(TARGET __zenohc_shared PROPERTY IMPORTED_IMPLIB "${_IMPORT_PREFIX}/@CMAKE_INSTALL_LIBDIR@/@IMPLIB@")
endif()

if(ZENOHC_BUILD_WITH_UNSTABLE_API)
target_compile_definitions(__zenohc_shared INTERFACE UNSTABLE)
endif()
if(ZENOHC_BUILD_WITH_SHARED_MEMORY)
target_compile_definitions(__zenohc_shared INTERFACE SHARED_MEMORY)
endif()

if(ZENOHC_LIB_STATIC)
add_library(zenohc::lib ALIAS __zenohc_static)
else()
Expand Down