cmake_minimum_required(VERSION 3.1.0) project(Rennbahn) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) message("Build type: RELEASE") endif() set(CMAKE_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) #find_package(Boost REQUIRED COMPONENTS iostreams system filesystem) find_package(Boost REQUIRED COMPONENTS iostreams system filesystem) find_package(fmt) include_directories(${CMAKE_SOURCE_DIR}/gnuplot-iostream) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed set(CMAKE_AUTOMOC ON) # Create code from a list of Qt designer ui files set(CMAKE_AUTOUIC ON) # uncomment for ATMega based version (needs usb library) #add_definitions(-DATMEGA) # add -no-pie flag set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie") # Find the QtWidgets library find_package(Qt5Widgets CONFIG REQUIRED) find_package(Qt5Sql REQUIRED) # check dependency for atmega find_path(LIBUSB_INCLUDE_DIR NAMES "libusb.h" PATH_SUFFIXES "include" "libusb" "libusb-1.0") set(CMAKE_PREFIX_PATH usr) find_library(LIBUSB_LIBRARY NAMES "libusb-1.0.so" "usb" "libusb" "libusb-1.0" PATH_SUFFIXES "lib" "lib32" "lib64") if(LIBUSB_LIBRARY) message("usb lib found" ${LIBUSB_LIBRARY}) else() message("usb lib not found") endif() if(LIBUSB_INCLUDE_DIR) add_definitions(-DATMEGA) message("usb include dir found") include_directories(${LIBUSB_INCLUDE_DIR}) else() message("usb include dir not found") endif() # Populate a CMake variable with the sources set(helloworld_SRCS main.cpp mainwindow.cpp windowrace.cpp hardwaresetup.cpp windowssettings.cpp counter.cpp countdown.cpp ampel.cpp database.cpp windowrennliste.cpp training.cpp timemodel.cpp qvectorhelper.cpp resultmodel.cpp result.cpp evaluation.cpp racelistgenerator.cpp datahelper.cpp colorwidget.cpp qrc_resource.cpp serial_port.cpp mainwindow.ui windowrace.ui windowssettings.ui windowrennliste.ui training.ui result.ui evaluation.ui ) # Tell CMake to create the helloworld executable add_executable(Rennbahn ${helloworld_SRCS} ) # Use the Widgets module from Qt 5 target_link_libraries(Rennbahn Qt5::Widgets Qt5::Core Qt5::Sql ${LIBUSB_LIBRARY} pthread fmt::fmt) target_link_libraries(Rennbahn ${Boost_LIBRARIES})