-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
34 lines (26 loc) · 1.43 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
########################################################
# Top-level CMakeLists.txt to build BME280-Driver Libraries
# @author LAGARDE Francois
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
########################################################
# ----- Project name and version -----
project(BME280-Driver)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/bin CACHE PATH "..." FORCE)
endif()
set( ${PROJECT_NAME}_VERSION_MAJOR 3 )
set( ${PROJECT_NAME}_VERSION_MINOR 3 )
set( ${PROJECT_NAME}_VERSION_PATCH 4 )
# set the C++ standard to C++ 17
set(CMAKE_CXX_STANDARD 17)
##BME280-Driver Sources
set(BME280-Driver ${PROJECT_SOURCE_DIR}/bme280.cpp ${PROJECT_SOURCE_DIR}/data.cpp ${PROJECT_SOURCE_DIR}/calib.cpp)
file(GLOB BME280_DRIVER_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/*.hpp)
include_directories(${PROJECT_SOURCE_DIR})
add_library(bme280 STATIC ${BME280-Driver})
# install configuration
install(FILES ${BME280_DRIVER_PUBLIC_HEADERS} DESTINATION include/bme280)
install(TARGETS bme280 ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/lib LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
add_executable(Test ${PROJECT_SOURCE_DIR}/examples/linux_userspace.cpp)
target_link_libraries(Test bme280)
install(TARGETS bme280 ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/bin RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)