Skip to content

Commit

Permalink
Fix build examples using find_package (#324)
Browse files Browse the repository at this point in the history
* fix: build examples using find_package

* fix: set system definition in package file
  • Loading branch information
jean-roland authored Jan 26, 2024
1 parent a0d58e7 commit d7269a9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions PackageConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,24 @@ if(NOT ("@IMPLIB@" STREQUAL ""))
set_property(TARGET __zenohpico_lib PROPERTY IMPORTED_IMPLIB "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/@IMPLIB@")
endif()
target_include_directories(__zenohpico_lib INTERFACE "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@")

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_compile_definitions(ZENOH_LINUX)
elseif(POSIX_COMPATIBLE)
add_compile_definitions(ZENOH_LINUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "BSD")
add_compile_definitions(ZENOH_BSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_compile_definitions(ZENOH_MACOS)
elseif(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
add_compile_definitions(EMSCRIPTEN)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_compile_definitions(ZENOH_WINDOWS)
elseif(CMAKE_SYSTEM_NAME MATCHES "Generic")
if(WITH_ZEPHYR)
add_compile_definitions(ZENOH_ZEPHYR)
elseif(WITH_FREERTOS_PLUS_TCP)
add_compile_definitions(ZENOH_FREERTOS_PLUS_TCP)
endif()
endif()

2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
project(zenohpico_examples LANGUAGES C)
include(../cmake/helpers.cmake)
set_default_build_type(Release)
configure_include_project(ZENOHPICO zenohpico zenohpico ".." zenohc "https://github.com/eclipse-zenoh/zenoh-pico" "")
configure_include_project(ZENOHPICO zenohpico zenohpico::static ".." zenohpico "https://github.com/eclipse-zenoh/zenoh-pico" "")
add_custom_target(examples ALL)
else()
message(STATUS "zenoh-pico examples")
Expand Down

0 comments on commit d7269a9

Please sign in to comment.