diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f2f314a..753c859c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,11 @@ project(lib_bluetoe CXX) option(BLUETOE_BUILD_UNIT_TESTS "If true, unit test targets are added are build.") +# Libray required by everything in Bluetoe. If there is need to add build options, +# add them on bluetoe::iface. add_library(bluetoe_iface INTERFACE) -target_compile_features(bluetoe_iface INTERFACE cxx_std_11) add_library(bluetoe::iface ALIAS bluetoe_iface) +target_compile_features(bluetoe_iface INTERFACE cxx_std_11) target_include_directories(bluetoe_iface INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) # Link Layer implementation based on radio hardware diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 21ac0ab9..fb8bbd1d 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -10,8 +10,13 @@ if (NOT CMAKE_CROSSCOMPILING) message(FATAL_ERROR " examples can only be cross compiled to arm cortex-m, missing -Dtoolchain_file on cmake invocation?") endif() +set(AVAILABLE_BINDINGS nrf51 nrf52) + +set(BINDING nrf52 CACHE STRING "Microcontroller target to build for") +set_property(CACHE BINDING PROPERTY STRINGS ${AVAILABLE_BINDINGS}) + if (NOT BINDING) - message(FATAL_ERROR " A binding must be defined. Use -DBINDING=nrf51. Current available bindings are nrf51, nrf52") + message(FATAL_ERROR " A binding must be defined. Use -DBINDING=nrf51. Current available bindings are ${AVAILABLE_BINDINGS}") endif() # include hardware specific compile options and definitions that must be apllied to the whole project @@ -50,6 +55,9 @@ add_subdirectory(assert) # bluetoe library add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/bluetoe) +# Additional settings for the Bluetoe library itself: +target_link_libraries(bluetoe_iface INTERFACE assert::arm) + function(add_bluetoe_example target_name) add_executable(${target_name} ${target_name}.cpp runtime.cpp) set_target_properties(${target_name}