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 Oct 2, 2024
1 parent f20f7c9 commit 8beee7a
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 @@ -323,6 +323,25 @@ function(target_sources_shared target)
target_include_directories(${target} PUBLIC ${WAKAAMA_EXAMPLE_SHARED_DIRECTORY})
endfunction()

# 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 8beee7a

Please sign in to comment.