-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
40 lines (30 loc) · 1.56 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
project(codal-ble-nano)
include("${CODAL_UTILS_LOCATION}")
# find sources and headers
RECURSIVE_FIND_DIR(TOP_LEVEL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/inc" "*.h")
RECURSIVE_FIND_FILE(TOP_LEVEL_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/source" "*.c??")
RECURSIVE_FIND_DIR(MODEL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/model" "*.h")
RECURSIVE_FIND_FILE(MODEL_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/model" "*.c??")
list(FIND CODAL_FIELDS "NO_BLE" TMP_RES)
message("${CODAL_FIELDS} ${TMP_RES}")
# if no ble is not defined, softdevice should be linked
if ("${TMP_RES}" EQUAL "-1")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -T\"${CMAKE_CURRENT_LIST_DIR}/ld/nrf52832.ld\"" PARENT_SCOPE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T\"${CMAKE_CURRENT_LIST_DIR}/ld/nrf52832.ld\"" PARENT_SCOPE)
else()
message("${BoldMagenta}Linking without Bluetooth.${ColourReset}")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -T\"${CMAKE_CURRENT_LIST_DIR}/ld/nrf52832-no-sd.ld\"" PARENT_SCOPE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T\"${CMAKE_CURRENT_LIST_DIR}/ld/nrf52832-no-sd.ld\"" PARENT_SCOPE)
endif()
set(CMAKE_SYSTEM_PROCESSOR "armv7-m" PARENT_SCOPE)
# add them
include_directories(${INCLUDE_DIRS} ${TOP_LEVEL_INCLUDE_DIRS} ${MODEL_INCLUDE_DIRS})
# create our target
add_library(codal-ble-nano ${TOP_LEVEL_SOURCE_FILES} ${MODEL_SOURCE_FILES})
target_link_libraries(
codal-ble-nano
codal-core
codal-nrf52
)
# expose it to parent cmake.
target_include_directories(codal-ble-nano PUBLIC ${MODEL_INCLUDE_DIRS} ${TOP_LEVEL_INCLUDE_DIRS})