forked from mirror/nheko
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
5 years ago
|
cmake_minimum_required(VERSION 3.7.0)
|
||
5 years ago
|
|
||
5 years ago
|
project(SingleApplication LANGUAGES CXX)
|
||
5 years ago
|
|
||
|
set(CMAKE_AUTOMOC ON)
|
||
|
|
||
|
add_library(${PROJECT_NAME} STATIC
|
||
|
singleapplication.cpp
|
||
|
singleapplication_p.cpp
|
||
5 years ago
|
)
|
||
|
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
||
5 years ago
|
|
||
|
# Find dependencies
|
||
5 years ago
|
find_package(Qt5 COMPONENTS Network REQUIRED)
|
||
|
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Network)
|
||
|
|
||
5 years ago
|
if(QAPPLICATION_CLASS STREQUAL QApplication)
|
||
|
find_package(Qt5 COMPONENTS Widgets REQUIRED)
|
||
5 years ago
|
target_link_libraries(${PROJECT_NAME} PUBLIC Qt5::Widgets)
|
||
5 years ago
|
elseif(QAPPLICATION_CLASS STREQUAL QGuiApplication)
|
||
|
find_package(Qt5 COMPONENTS Gui REQUIRED)
|
||
5 years ago
|
target_link_libraries(${PROJECT_NAME} PUBLIC Qt5::Gui)
|
||
5 years ago
|
else()
|
||
5 years ago
|
set(QAPPLICATION_CLASS QCoreApplication)
|
||
5 years ago
|
find_package(Qt5 COMPONENTS Core REQUIRED)
|
||
5 years ago
|
target_link_libraries(${PROJECT_NAME} PUBLIC Qt5::Core)
|
||
5 years ago
|
endif()
|
||
|
|
||
|
if(WIN32)
|
||
|
target_link_libraries(${PROJECT_NAME} PRIVATE advapi32)
|
||
|
endif()
|
||
|
|
||
5 years ago
|
target_compile_definitions(${PROJECT_NAME} PUBLIC QAPPLICATION_CLASS=${QAPPLICATION_CLASS})
|
||
5 years ago
|
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|