aboutsummaryrefslogtreecommitdiff
path: root/src/qt/CMakeLists.txt
blob: 3702ad5828995b0e66af5f4fd5e1c577137d0707 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
SET(FRONTEND_NAME "OFQT")
enable_language(CXX)

find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Gui REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Gui REQUIRED)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

list(APPEND
    QT_SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/settings.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/settings.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/workers.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/workers.hpp

    ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.ui
    ${CMAKE_CURRENT_SOURCE_DIR}/assets.qrc
)

if(WIN32)
    string(REPLACE "." "," CMAKE_PROJECT_COMMAVERSION ${CMAKE_PROJECT_VERSION})
    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/assets/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
    list(APPEND QT_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

add_executable(${FRONTEND_NAME} WIN32 ${QT_SOURCES})
target_compile_options(${FRONTEND_NAME} PUBLIC ${CFLAGS})
target_link_libraries(${FRONTEND_NAME} PRIVATE tvn)
target_link_libraries(${FRONTEND_NAME} PRIVATE Threads::Threads)
target_link_libraries(${FRONTEND_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
set_property(TARGET ${FRONTEND_NAME} PROPERTY CXX_STANDARD 11)
install(TARGETS ${FRONTEND_NAME})