27 lines
804 B
CMake
27 lines
804 B
CMake
cmake_minimum_required(VERSION 3.0)
|
|
project(environmentsensor)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
find_library(I2C_LIBRARY NAMES i2c REQUIRED)
|
|
find_path(I2C_INCLUDE_DIR NAMES linux/i2c-dev.h REQUIRED)
|
|
|
|
add_executable(environmentsensor main.cpp
|
|
bme68x.c
|
|
bme68x.c
|
|
common.c
|
|
i2c_linux.cpp)
|
|
|
|
if(I2C_LIBRARY AND I2C_INCLUDE_DIR)
|
|
message(STATUS "Found I2C library: ${I2C_LIBRARY}")
|
|
message(STATUS "Found I2C include directory: ${I2C_INCLUDE_DIR}")
|
|
# Add to your target
|
|
target_link_libraries(environmentsensor PRIVATE ${I2C_LIBRARY})
|
|
target_include_directories(environmentsensor PRIVATE ${I2C_INCLUDE_DIR})
|
|
else()
|
|
message(FATAL_ERROR "Could not find I2C library or include directory.")
|
|
endif()
|
|
|
|
install(TARGETS environmentsensor
|
|
RUNTIME DESTINATION bin)
|