-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathCMakeLists.txt
44 lines (33 loc) · 1.21 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
41
42
43
44
cmake_minimum_required(VERSION 3.3)
PROJECT(txtempus
VERSION 1.0.0
LANGUAGES C CXX)
include(GNUInstallDirs)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
ADD_DEFINITIONS(-Wall -O3)
set(CMAKE_INSTALL_PREFIX /usr)
set(SRC_FILES
src/txtempus.cc
src/dcf77-source.cc
src/wwvb-source.cc
src/jjy-source.cc
src/msf-source.cc
src/hardware-control.cc)
set(INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include)
set(PLATFORM_DEPENDENCIES "")
# select the platform
set(SUPPORTED_PLATFORMS rpi jetson)
set(PLATFORM "rpi" CACHE STRING "Platform")
if(NOT ${PLATFORM} IN_LIST SUPPORTED_PLATFORMS)
string(REPLACE ";" ", " SUPPORTED_PLATFORM_LIST "${SUPPORTED_PLATFORMS}")
message(FATAL_ERROR "'${PLATFORM}' is not a supported platform.\nSupported platforms: [${SUPPORTED_PLATFORM_LIST}]")
endif()
message(STATUS "Platform: ${PLATFORM}")
include("cmake/${PLATFORM}-control.cmake")
list(APPEND INCLUDE_DIRS "include/${PLATFORM}")
add_executable(${PROJECT_NAME} ${SRC_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${PLATFORM_DEPENDENCIES})
# install
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)