Hello everyone, I`m new to this forum and CMake.
For a school project, we are working with c++.
And we are using CMake to link and build the files.
Now a few months in the project I’m working with the MLX90461 IR camera.
I’m using the following GitHub project to make the IR camera https://github.com/Arthav24/MLX90641
In this GitHub project, there is a simple example code which can be run with the makefile.
But I want to include the example code to the CMakeLists.
I have the following CMakeFile.txt file
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 20)
project(robot-on-wheels)
# MAIN CPP FILE TO RUN #
add_executable(robot main.cpp) # Ignore this file for now, this one works great!
add_executable(camera MLX90641/Examples/print_grid.cpp)
# Add files to libray for the MLX90641 #
add_library(mlx90641
MLX90641/MLX90641_API.cpp
MLX90641/MLX90641_I2C_Driver.cpp)
# MLX90641 #
target_link_libraries(mlx90641 -lm)
target_link_libraries(mlx90641 -lbcm2835)
add_definitions(-I/usr/include -L/usr/lib -lwiringPi)
target_link_libraries(camera mlx90641)
When I run the exmaple code with the make file it runs:
g++ -IHeaders/ MLX90641_API.cpp MLX90641_I2C_Driver.cpp Examples/print_grid.cpp -o printgrid -lm -lbcm2835
And it links the bcm2835 library. But somehow I can’t get it to work via the CMakeLists.txt file.
In bouth the MLX90641_API.cpp
and print_grid.cpp
There is a #include <bcm2835.h>
without a error of CLion.
I have installed the bcm2835 file based on this anwers on the Raspberry pi forum:
https://www.raspberrypi.org/forums/viewtopic.php?t=15892#p1299984
Is there somebody here that could me out with this? I’m stuck at this problem for 3 days now.