Simplify singleapplication integration

This commit is contained in:
Martin Brodbeck 2025-03-17 14:23:46 +01:00
parent da038ca875
commit d73afbf22e
3 changed files with 11 additions and 13 deletions

3
.gitmodules vendored
View file

@ -1,6 +1,3 @@
[submodule "subprojects/nlohmann_json"] [submodule "subprojects/nlohmann_json"]
path = subprojects/nlohmann_json path = subprojects/nlohmann_json
url = https://github.com/nlohmann/json.git url = https://github.com/nlohmann/json.git
[submodule "subprojects/singleapplication"]
path = subprojects/singleapplication/singleapplication.git
url = https://github.com/itay-grudev/SingleApplication.git

View file

@ -9,13 +9,18 @@ set(CMAKE_AUTORCC ON)
# Find the QtWidgets library # Find the QtWidgets library
find_package(Qt6 COMPONENTS Widgets Network PrintSupport CONFIG REQUIRED) find_package(Qt6 COMPONENTS Widgets Network PrintSupport CONFIG REQUIRED)
#find_package(Qt5Widgets CONFIG REQUIRED)
#find_package(Qt5PrintSupport CONFIG REQUIRED)
# For SingleApplication: # For SingleApplication:
#find_package(Qt5Network CONFIG REQUIRED) include(FetchContent)
set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "Qt version to use, defaults to 6") set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "Qt version to use, defaults to 6")
set(QAPPLICATION_CLASS QApplication) set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
FetchContent_Declare(
SingleApplication
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication
GIT_TAG v3.5.2
#GIT_TAG master
)
FetchContent_MakeAvailable(SingleApplication)
add_compile_definitions(QAPPLICATION_CLASS=${QAPPLICATION_CLASS}) add_compile_definitions(QAPPLICATION_CLASS=${QAPPLICATION_CLASS})
set(GUI_SOURCES set(GUI_SOURCES
@ -35,15 +40,12 @@ set(GUI_SOURCES
settingsdialog.cpp settingsdialog.cpp
settingsdialog.ui settingsdialog.ui
../../kima2.qrc ../../kima2.qrc
${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication.cpp
${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication_p.cpp
) )
add_executable(kima2 ${GUI_SOURCES} kima2.rc) add_executable(kima2 ${GUI_SOURCES} kima2.rc)
target_include_directories(kima2 PRIVATE ${PROJECT_BINARY_DIR}) target_include_directories(kima2 PRIVATE ${PROJECT_BINARY_DIR})
target_include_directories(kima2 PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git) #target_include_directories(kima2 PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git)
# target_link_libraries(kima2 core printer Qt5::Widgets Qt5::PrintSupport Qt5::Network stdc++fs) target_link_libraries(kima2 core printer Qt::Core Qt::PrintSupport Qt::Network SingleApplication::SingleApplication)
target_link_libraries(kima2 core printer Qt::Core Qt::PrintSupport Qt::Network)
if(WIN32) if(WIN32)
set_target_properties(kima2 PROPERTIES LINK_FLAGS "-mwindows") set_target_properties(kima2 PROPERTIES LINK_FLAGS "-mwindows")

@ -1 +0,0 @@
Subproject commit 494772e98cef0aa88124f154feb575cc60b08b38