Skip to content

Commit d5c4d2c

Browse files
Copilotdoxygen
andauthored
doxywizard: copy i18n files to build dir for relative .qrc paths
Agent-Logs-Url: https://github.com/doxygen/doxygen/sessions/681ea390-42f1-4db7-8b50-73ccc09b22f9 Co-authored-by: doxygen <1300762+doxygen@users.noreply.github.com>
1 parent aba4a54 commit d5c4d2c

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

addon/doxywizard/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ file(GLOB DOXYWIZARD_TRANSLATION_FILES CONFIGURE_DEPENDS "${TRANSLATIONS_DIR}/do
156156

157157
find_package(Qt${QT_VERSION_MAJOR}LinguistTools QUIET)
158158
if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND)
159-
set_source_files_properties(${DOXYWIZARD_TRANSLATION_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR})
159+
set(I18N_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/i18n)
160+
file(MAKE_DIRECTORY ${I18N_BINARY_DIR})
161+
set_source_files_properties(${DOXYWIZARD_TRANSLATION_FILES} PROPERTIES OUTPUT_LOCATION ${I18N_BINARY_DIR})
160162
qt_add_translation(doxywizard_QM_FILES ${DOXYWIZARD_TRANSLATION_FILES})
161163
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
162164
execute_process(
@@ -171,18 +173,20 @@ if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND)
171173
foreach(ts_file ${DOXYWIZARD_TRANSLATION_FILES})
172174
get_filename_component(ts_name ${ts_file} NAME_WE)
173175
string(REGEX REPLACE "doxywizard_(.+)" "\\1" LOCALE "${ts_name}")
174-
set(qm_file "${CMAKE_CURRENT_BINARY_DIR}/${ts_name}.qm")
176+
set(qm_file "${I18N_BINARY_DIR}/${ts_name}.qm")
175177
list(APPEND doxywizard_QM_FILES_PATHS ${qm_file})
176178

177179
if (QT_TRANSLATIONS_DIR)
178180
if (EXISTS "${QT_TRANSLATIONS_DIR}/qtbase_${LOCALE}.qm")
179-
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"qtbase_${LOCALE}.qm\">${QT_TRANSLATIONS_DIR}/qtbase_${LOCALE}.qm</file>\n")
181+
configure_file("${QT_TRANSLATIONS_DIR}/qtbase_${LOCALE}.qm" "${I18N_BINARY_DIR}/qtbase_${LOCALE}.qm" COPYONLY)
182+
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"qtbase_${LOCALE}.qm\">i18n/qtbase_${LOCALE}.qm</file>\n")
180183
else()
181184
message(WARNING "Qt translation file ${QT_TRANSLATIONS_DIR}/qtbase_${LOCALE}.qm not found")
182185
endif()
183186
endif()
184-
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"config_${LOCALE}.xml\">${PROJECT_SOURCE_DIR}/src/i18n/config_${LOCALE}.xml</file>\n")
185-
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"${ts_name}.qm\">${qm_file}</file>\n")
187+
configure_file("${PROJECT_SOURCE_DIR}/src/i18n/config_${LOCALE}.xml" "${I18N_BINARY_DIR}/config_${LOCALE}.xml" COPYONLY)
188+
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"config_${LOCALE}.xml\">i18n/config_${LOCALE}.xml</file>\n")
189+
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"${ts_name}.qm\">i18n/${ts_name}.qm</file>\n")
186190
endforeach()
187191
string(APPEND TRANSLATIONS_QRC_CONTENT " </qresource>\n</RCC>\n")
188192

0 commit comments

Comments
 (0)