2019-05-08 07:03:27 -04:00
|
|
|
cmake_minimum_required(VERSION 3.7.1)
|
2019-03-26 14:24:36 -04:00
|
|
|
project(umcumgr C)
|
|
|
|
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
2019-05-07 12:19:42 -04:00
|
|
|
|
2019-05-08 06:11:57 -04:00
|
|
|
OPTION(DO_UPLOAD_SHA "Send data SHA with update packets" OFF)
|
|
|
|
OPTION(SANITIZE "ASAN" OFF)
|
2019-05-07 12:19:42 -04:00
|
|
|
|
|
|
|
add_executable(umcumgr
|
|
|
|
src/base64.c
|
|
|
|
src/image.c
|
|
|
|
src/main.c
|
|
|
|
src/crc16_sw.c
|
|
|
|
src/termios_util.c)
|
|
|
|
|
|
|
|
if(SANITIZE)
|
|
|
|
message(STATUS "SANITIZE Enabled")
|
|
|
|
set(CMAKE_C_FLAGS
|
|
|
|
"${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined")
|
|
|
|
endif(SANITIZE)
|
|
|
|
|
2019-05-08 06:11:57 -04:00
|
|
|
if (DO_UPLOAD_SHA)
|
2019-05-07 12:19:42 -04:00
|
|
|
message(STATUS "Enabled data SHA on update packets")
|
|
|
|
add_definitions(-DDO_UPLOAD_SHA)
|
|
|
|
target_sources(umcumgr PRIVATE src/sha256.c)
|
|
|
|
endif ()
|
2019-03-26 14:24:36 -04:00
|
|
|
|
|
|
|
target_include_directories(umcumgr PRIVATE tinycbor/src)
|
2019-05-08 07:48:07 -04:00
|
|
|
find_library(TINYCBOR_LIB tinycbor ${CMAKE_SOURCE_DIR}/tinycbor/lib/)
|
|
|
|
target_link_libraries(umcumgr ${TINYCBOR_LIB})
|
2019-05-08 08:23:36 -04:00
|
|
|
|
|
|
|
install(TARGETS umcumgr DESTINATION bin)
|