summary refs log tree commit diff
path: root/third_party/SingleApplication-3.2.0-dc8042b/CMakeLists.txt
diff options
context:
space:
mode:
authorLorenDB <computersemiexpert@outlook.com>2020-11-09 21:28:41 -0500
committerLoren Burkholder <computersemiexpert@outlook.com>2020-12-24 21:16:46 -0500
commit53f45bdb1c9ee2b42b88ca4587775756f8daa124 (patch)
treeab8b89b8016d37dfb4a1e9e0aaae50a9d86b2d6f /third_party/SingleApplication-3.2.0-dc8042b/CMakeLists.txt
parentMerge pull request #357 from LorenDB/qkchdocs (diff)
downloadnheko-53f45bdb1c9ee2b42b88ca4587775756f8daa124.tar.xz
Switch profile code to a more flexible method
This introduces a new version of SingleApplication as well.
Diffstat (limited to 'third_party/SingleApplication-3.2.0-dc8042b/CMakeLists.txt')
-rw-r--r--third_party/SingleApplication-3.2.0-dc8042b/CMakeLists.txt40
1 files changed, 40 insertions, 0 deletions
diff --git a/third_party/SingleApplication-3.2.0-dc8042b/CMakeLists.txt b/third_party/SingleApplication-3.2.0-dc8042b/CMakeLists.txt
new file mode 100644
index 00000000..ae1b1439
--- /dev/null
+++ b/third_party/SingleApplication-3.2.0-dc8042b/CMakeLists.txt
@@ -0,0 +1,40 @@
+cmake_minimum_required(VERSION 3.7.0)
+
+project(SingleApplication LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+add_library(${PROJECT_NAME} STATIC
+    singleapplication.cpp
+    singleapplication_p.cpp
+)
+add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
+
+if(NOT QT_DEFAULT_MAJOR_VERSION)
+    set(QT_DEFAULT_MAJOR_VERSION 5 CACHE STRING "Qt version to use (5 or 6), defaults to 5")
+endif()
+
+# Find dependencies
+set(QT_COMPONENTS Core Network)
+set(QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::Core Qt${QT_DEFAULT_MAJOR_VERSION}::Network)
+
+if(QAPPLICATION_CLASS STREQUAL QApplication)
+    list(APPEND QT_COMPONENTS Widgets)
+    list(APPEND QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::Widgets)
+elseif(QAPPLICATION_CLASS STREQUAL QGuiApplication)
+    list(APPEND QT_COMPONENTS Gui)
+    list(APPEND QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::Gui)
+else()
+    set(QAPPLICATION_CLASS QCoreApplication)
+endif()
+
+find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS ${QT_COMPONENTS} REQUIRED)
+
+target_link_libraries(${PROJECT_NAME} PUBLIC ${QT_LIBRARIES})
+
+if(WIN32)
+    target_link_libraries(${PROJECT_NAME} PRIVATE advapi32)
+endif()
+
+target_compile_definitions(${PROJECT_NAME} PUBLIC QAPPLICATION_CLASS=${QAPPLICATION_CLASS})
+target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})