-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add POSIX target for small posix based RTOS's i.e. NuttX
- Loading branch information
1 parent
e9165d1
commit ef41809
Showing
2 changed files
with
14 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
# Contributors: | ||
# ZettaScale Zenoh Team, <[email protected]> | ||
# | ||
cmake_minimum_required(VERSION 3.8) | ||
cmake_minimum_required(VERSION 3.13) | ||
|
||
project(libzenohpico VERSION 0.7.0.1 LANGUAGES C) | ||
|
||
|
@@ -63,6 +63,9 @@ string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE) | |
|
||
if(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
add_definition(ZENOH_LINUX) | ||
set(CHECK_THREADS "ON") | ||
elseif(POSIX_COMPATIBLE) | ||
add_definition(ZENOH_LINUX) | ||
elseif(CMAKE_SYSTEM_NAME MATCHES "BSD") | ||
add_definition(ZENOH_BSD) | ||
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") | ||
|
@@ -99,7 +102,9 @@ if(SKBUILD) | |
endif() | ||
|
||
set(THREADS_PREFER_PTHREAD_FLAG ON) | ||
find_package(Threads REQUIRED) | ||
if(CHECK_THREADS) | ||
find_package(Threads REQUIRED) | ||
endif() | ||
|
||
if(CMAKE_BUILD_TYPE MATCHES "DEBUG") | ||
if(UNIX) | ||
|
@@ -160,7 +165,7 @@ file(GLOB Sources "src/*.c" | |
if(WITH_ZEPHYR) | ||
file (GLOB Sources_Zephyr "src/system/zephyr/*.c") | ||
list(APPEND Sources ${Sources_Zephyr}) | ||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "BSD") | ||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "BSD" OR POSIX_COMPATIBLE) | ||
file (GLOB Sources_Unix "src/system/unix/*.c") | ||
list(APPEND Sources ${Sources_Unix}) | ||
elseif(CMAKE_SYSTEM_NAME MATCHES "Emscripten") | ||
|
@@ -176,7 +181,9 @@ link_directories(${LIBRARY_OUTPUT_PATH}) | |
|
||
target_sources(${Libname} PRIVATE ${Sources}) | ||
|
||
target_link_libraries(${Libname} Threads::Threads) | ||
if(CHECK_THREADS) | ||
target_link_libraries(${Libname} Threads::Threads) | ||
endif() | ||
|
||
if(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
target_link_libraries(${Libname} rt) | ||
|
@@ -196,6 +203,7 @@ option(BUILD_EXAMPLES "Use this to also build the examples." ON) | |
option(BUILD_TOOLS "Use this to also build the tools." OFF) | ||
option(BUILD_TESTING "Use this to also build tests." ON) | ||
option(BUILD_INTEGRATION "Use this to also build integration tests." OFF) | ||
option(CHECK_THREADS "Check Threads library" ON) | ||
|
||
message(STATUS "Produce Debian and RPM packages: ${PACKAGING}") | ||
message(STATUS "Build examples: ${BUILD_EXAMPLES}") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters