2023-07-23 21:05:22 +02:00
|
|
|
cmake_minimum_required(VERSION 3.17.0 FATAL_ERROR)
|
2016-10-02 21:59:28 +02:00
|
|
|
|
|
|
|
# metadata
|
|
|
|
set(META_PROJECT_NAME syncthingctl)
|
|
|
|
set(META_APP_NAME "Syncthing control")
|
|
|
|
set(META_APP_DESCRIPTION "Command line app to control Syncthing")
|
|
|
|
set(META_PROJECT_TYPE application)
|
2018-04-07 22:01:54 +02:00
|
|
|
set(META_JS_SRC_DIR .)
|
2016-10-02 21:59:28 +02:00
|
|
|
|
|
|
|
# add project files
|
2019-02-06 17:36:14 +01:00
|
|
|
set(HEADER_FILES helper.h args.h application.h)
|
|
|
|
set(SRC_FILES main.cpp args.cpp application.cpp)
|
|
|
|
set(TEST_HEADER_FILES)
|
|
|
|
set(TEST_SRC_FILES tests/application.cpp)
|
2016-10-02 21:59:28 +02:00
|
|
|
|
2023-02-27 18:22:28 +01:00
|
|
|
# use testfiles directory from syncthingconnector
|
|
|
|
set(META_SRCDIR_REFS "${CMAKE_CURRENT_SOURCE_DIR}\n${CMAKE_CURRENT_SOURCE_DIR}/../syncthingconnector")
|
2023-02-27 18:02:58 +01:00
|
|
|
|
2016-10-02 21:59:28 +02:00
|
|
|
# find c++utilities
|
2023-02-27 18:02:58 +01:00
|
|
|
find_package(${PACKAGE_NAMESPACE_PREFIX}c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.21.0 REQUIRED)
|
2016-10-02 21:59:28 +02:00
|
|
|
use_cpp_utilities()
|
|
|
|
|
|
|
|
# find qtutilities
|
2021-10-02 11:58:02 +02:00
|
|
|
find_package(${PACKAGE_NAMESPACE_PREFIX}qtutilities${CONFIGURATION_PACKAGE_SUFFIX_QTUTILITIES} 6.0.0 REQUIRED)
|
2021-01-01 18:50:46 +01:00
|
|
|
use_qt_utilities(ONLY_HEADERS VISIBILITY PUBLIC)
|
2016-10-02 21:59:28 +02:00
|
|
|
|
|
|
|
# find backend libraries
|
|
|
|
find_package(syncthingconnector ${META_APP_VERSION} REQUIRED)
|
|
|
|
use_syncthingconnector()
|
|
|
|
|
2023-02-11 15:55:45 +01:00
|
|
|
# find libraries used by tests
|
2018-05-01 01:10:46 +02:00
|
|
|
find_package(syncthingtesthelper ${META_APP_VERSION} REQUIRED)
|
2019-03-13 19:12:23 +01:00
|
|
|
list(APPEND TEST_LIBRARIES ${SYNCTHINGTESTHELPER_LIB})
|
2024-01-30 22:35:47 +01:00
|
|
|
list(APPEND PRIVATE_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/../testhelper/include")
|
2023-02-11 15:55:45 +01:00
|
|
|
use_standard_filesystem(LIBRARIES_VARIABLE "TEST_LIBRARIES" PACKAGES_VARIABLE "TEST_PACKAGES" OPTIONAL)
|
2018-05-01 01:10:46 +02:00
|
|
|
|
2016-10-02 21:59:28 +02:00
|
|
|
# include modules to apply configuration
|
|
|
|
include(BasicConfig)
|
2019-03-13 19:12:23 +01:00
|
|
|
include(QtJsProviderConfig)
|
2019-02-06 17:36:14 +01:00
|
|
|
if (JS_PROVIDER)
|
2018-04-07 22:01:54 +02:00
|
|
|
list(APPEND HEADER_FILES jsconsole.h)
|
|
|
|
list(APPEND SRC_FILES jsconsole.cpp)
|
2018-04-07 22:57:36 +02:00
|
|
|
list(APPEND RES_FILES resources/js/js.qrc)
|
2019-02-06 17:36:14 +01:00
|
|
|
endif ()
|
2016-10-02 21:59:28 +02:00
|
|
|
include(QtConfig)
|
|
|
|
include(WindowsResources)
|
|
|
|
include(AppTarget)
|
2019-03-13 19:12:23 +01:00
|
|
|
include(TestTarget)
|
2016-10-02 21:59:28 +02:00
|
|
|
include(ShellCompletion)
|
|
|
|
include(Doxygen)
|
|
|
|
include(ConfigHeader)
|
2021-10-12 23:40:35 +02:00
|
|
|
|
2024-01-26 23:53:01 +01:00
|
|
|
# export target name to use syncthingctl for shortcuts in syncthingtray's desktop file
|
|
|
|
set(${META_PROJECT_VARNAME_UPPER}_TARGET_NAME
|
|
|
|
"${META_TARGET_NAME}"
|
|
|
|
PARENT_SCOPE)
|
|
|
|
|
2021-10-13 00:14:35 +02:00
|
|
|
# avoid running this test in parallel with other tests spawning a Syncthing test instance
|
2021-10-12 23:40:35 +02:00
|
|
|
if (META_MAIN_TEST_NAME)
|
2021-10-13 00:14:35 +02:00
|
|
|
set_tests_properties("${META_MAIN_TEST_NAME}" PROPERTIES RESOURCE_LOCK "syncthingtestinstance")
|
2021-10-12 23:40:35 +02:00
|
|
|
endif ()
|