##
## Copyright (c) Toposens GmbH 2021. All rights reserved.
##

cmake_minimum_required(VERSION 3.5.1)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# set the project name
project(toposens-sensor-library-examples)

add_library(example_common 
            example_common.h
            example_common.c)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

# add n-frame-single-shot-example executable
add_executable(n_frames_single_shot_example n_frames_single_shot_example.c )
target_link_libraries(n_frames_single_shot_example toposens-sensor-library example_common)

# add n-frame-single-shot-example executable
add_executable(n_frames_single_shot_example_uart n_frames_single_shot_example_uart.c )
target_link_libraries(n_frames_single_shot_example_uart toposens-sensor-library example_common)

# add adc-dumpfile-save-example executable
add_executable(adc_dump_save_example adc_dump_save_example.c )
target_link_libraries(adc_dump_save_example toposens-sensor-library example_common)

# add logging-example executable
add_executable(log_message_example log_message_example.c )
target_link_libraries(log_message_example toposens-sensor-library example_common)

# add regular printf
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DREGULAR_PRINTF")

find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
if(NOT CLANG_TIDY_COMMAND)
  message("Clang-tidy not found!")
else()
  set(CMAKE_C_CLANG_TIDY
      clang-tidy;
      -header-filter=.;
      )
endif()
