Skip to content

Commit

Permalink
cmake: Add Wakaama static library
Browse files Browse the repository at this point in the history
The static library can be configured with CMake variables and then be
linked to user applications.
  • Loading branch information
LukasWoodtli committed Sep 5, 2024
1 parent 348370c commit 81430c2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions wakaama.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,25 @@ function(target_sources_shared target)
target_include_directories(${target} PUBLIC ${WAKAAMA_EXAMPLE_SHARED_DIRECTORY})
endfunction()

# Wakaama library Static library that users of Wakaama can link against
add_library(wakaama_static STATIC)
target_sources_wakaama(wakaama_static)
target_include_directories(wakaama_static PUBLIC ${WAKAAMA_TOP_LEVEL_DIRECTORY}/include/)

if(WAKAAMA_TRANSPORT STREQUAL POSIX_UDP)
target_link_libraries(wakaama_static PUBLIC wakaama_transport_posix_udp)
elseif(WAKAAMA_TRANSPORT STREQUAL TINYDTLS)
target_link_libraries(wakaama_static PUBLIC wakaama_transport_tinydtls)
endif()

if(WAKAAMA_PLATFORM STREQUAL POSIX)
target_link_libraries(wakaama_static PUBLIC wakaama_platform_posix)
endif()

if(WAKAAMA_CLI)
target_link_libraries(wakaama_static PUBLIC wakaama_command_line)
endif()

# Enforce a certain level of hygiene
add_compile_options(
-Waggregate-return
Expand Down

0 comments on commit 81430c2

Please sign in to comment.