From 95341de6ca655a67abbd00d4c837152275bdd8e7 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 1 Aug 2025 15:52:08 +0100 Subject: [PATCH] cmake, refactor: Move handling of Qt TS files into `locale` directory This change offers a few advantages, such as: - a more readable and cleaner `ts_files.cmake` (see the next commit); - a scoped `ts_files` variable; - improved code locality; - no need to adjust the location of the resulting `*.qm` files. --- src/qt/CMakeLists.txt | 8 +------- src/qt/locale/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 src/qt/locale/CMakeLists.txt diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 87a5a2bef3b..ad858400a81 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -245,13 +245,7 @@ if(qt_lib_type STREQUAL "STATIC_LIBRARY") ) endif() -file(GLOB ts_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} locale/*.ts) -set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/locale) -if(Qt6_VERSION VERSION_GREATER_EQUAL 6.7) - qt6_add_lrelease(TS_FILES ${ts_files} OPTIONS -silent) -else() - qt6_add_lrelease(bitcoinqt TS_FILES ${ts_files} OPTIONS -silent) -endif() +add_subdirectory(locale) add_executable(bitcoin-qt main.cpp diff --git a/src/qt/locale/CMakeLists.txt b/src/qt/locale/CMakeLists.txt new file mode 100644 index 00000000000..7f46349d7be --- /dev/null +++ b/src/qt/locale/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (c) 2025-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +file(GLOB ts_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.ts") + +if(Qt6_VERSION VERSION_GREATER_EQUAL 6.7) + qt6_add_lrelease(TS_FILES ${ts_files} LRELEASE_TARGET bitcoinqt_lrelease OPTIONS -silent) +else() + qt6_add_lrelease(bitcoinqt TS_FILES ${ts_files} OPTIONS -silent) +endif() + +add_dependencies(bitcoinqt bitcoinqt_lrelease)