I hope the question is not too trivial, but I am trying to convert a gcc command into a CMakeLists.txt. Unfortunately I am failing at understanding the basics and I hope you can help me. My main reason for wanting to do this is that I'm building the whole thing on a Raspberry and it has quite a few performance problems. So it takes a good 90min to build the whole thing. With cmake I hope that the build process is done faster when changes are made. Which should be theoretically possible.
Here is the my gcc command
gcc -std=c99 -flto=1 -I$HOME/install/include -L$HOME/install/lib main.c MotorSteuerung.c
-lopen62541 -lmbedtls -lmbedx509 -lmbedcrypto -o MotorSteuerung
I had already started with the cmake file, but unfortunately I don't quite understand what I have to do. Especially the -flto=1 which limits the parallel flags to 1 (otherwise it can't be built on the raspberry) led me here after a long search. But I also don't quite understand how to actually integrate the libraries...
cmake_minimum_required(VERSION 3.20)
# set the project name
project(MotorSteuerung)
# Set the output folder where your program will be created
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
# The following folder will be included
include_directories("${PROJECT_SOURCE_DIR}")
# add the executable
add_executable(Tutorial open62541::open62541)
Thanks for your help