Skip to content

Commit

Permalink
fix: set system definition in package file
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Jan 22, 2024
1 parent a1aa77b commit 01f04e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
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: 0 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ function(add_example name)
endfunction()

if(UNIX)
add_definitions(-DZENOH_LINUX)
if(CMAKE_C_STANDARD MATCHES "99")
add_example(z_put unix/c99/z_put.c)
add_example(z_pub unix/c99/z_pub.c)
Expand Down Expand Up @@ -50,7 +49,6 @@ if(UNIX)
add_example(z_sub_thr unix/c11/z_sub_thr.c)
endif()
elseif(MSVC)
add_definitions(-DZENOH_WINDOWS)
add_example(z_put windows/z_put.c)
add_example(z_pub windows/z_pub.c)
add_example(z_pub_st windows/z_pub_st.c)
Expand Down

0 comments on commit 01f04e5

Please sign in to comment.