From d48d2c6333872ae882b0628f9db0499c1a24a61d Mon Sep 17 00:00:00 2001 From: QuentiumYT Date: Thu, 5 Mar 2026 09:19:22 +0100 Subject: [PATCH] Replace deprecated qt_add_translation function --- src/CMakeLists.txt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b0c9245935..3f516c01bf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,11 +13,12 @@ file(GLOB copyq_FORMS ui/*.ui ) +# translations +file(GLOB copyq_TRANSLATIONS ../translations/*.ts) + set(copyq_RESOURCES copyq.qrc) # Qt include paths and definitions -set(copyq_DEFINITIONS ${${copyq_qt}Widgets_DEFINITIONS}) - include(notifications.cmake) include(platform/platform.cmake) @@ -31,12 +32,6 @@ if (USE_QXT) list(APPEND copyq_DEFINITIONS QXT_STATIC COPYQ_GLOBAL_SHORTCUTS) endif() -# translations -file(GLOB copyq_TRANSLATIONS ../translations/*.ts) - -find_package(${copyq_qt}LinguistTools REQUIRED) -qt_add_translation(copyq_QM ${copyq_TRANSLATIONS}) - qt_wrap_ui(copyq_FORMS_HEADERS ${copyq_FORMS}) qt_add_resources(copyq_RESOURCES_RCC ${copyq_RESOURCES}) @@ -65,6 +60,12 @@ set(copyq_COMPILE ) add_library(copyq-common OBJECT ${copyq_COMPILE}) +find_package(${copyq_qt} REQUIRED COMPONENTS LinguistTools) +qt_add_translations(copyq-common + TS_FILES ${copyq_TRANSLATIONS} + QM_FILES_OUTPUT_VARIABLE copyq_QM +) + if (NOT copyq_version) message(FATAL_ERROR "Application version is unset") endif() @@ -129,8 +130,8 @@ endforeach() set_target_properties(copyq-common PROPERTIES COMPILE_DEFINITIONS "${copyq_DEFINITIONS}") set_target_properties(${COPYQ_EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "${copyq_LINK_FLAGS}") -target_link_libraries(${COPYQ_EXECUTABLE_NAME} ${copyq_LIBRARIES}) target_link_libraries(copyq-common ${copyq_LIBRARIES}) +target_link_libraries(${COPYQ_EXECUTABLE_NAME} ${copyq_LIBRARIES}) target_include_directories(copyq-common PRIVATE ${CMAKE_CURRENT_BINARY_DIR} .) target_include_directories(${COPYQ_EXECUTABLE_NAME} PRIVATE .)