#MUST BE NAMED CMakeLists.txt IN PROJECT FOLDER cmake_minimum_required(VERSION 3.28) project(CSpace C) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mconsole") # Specify the path to the include directory where libserialport.h is located include_directories("/mingw64/include") # Add the path to the library directory where libserialport.a is located link_directories("/mingw64/lib") # Add the executable target add_executable(CSpace main.c) # Link the libserialport library to your executable target_link_libraries(CSpace libserialport)