Skip to content

Commit 90e4bb0

Browse files
hillwoodrocBLumia
authored andcommitted
fix(cmake): Fix lrelease not found by using Qt6 LinguistTools target
Use Qt6::lrelease imported target from Qt6 LinguistTools instead of manually guessing the lrelease path, fixing build failures when the command cannot be found.
1 parent 38eae5a commit 90e4bb0

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

cmake/translation-generate.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
function(TRANSLATION_GENERATE QMS)
2-
find_package(Qt${QT_VERSION_MAJOR}LinguistTools QUIET)
2+
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS LinguistTools)
33

4-
if (NOT Qt${QT_VERSION_MAJOR}_LRELEASE_EXECUTABLE)
5-
set(QT_LRELEASE "/lib/qt${QT_VERSION_MAJOR}/bin/lrelease")
6-
message(STATUS "NOT found lrelease, set QT_LRELEASE = ${QT_LRELEASE}")
4+
if (QT_VERSION_MAJOR MATCHES 6)
5+
get_target_property(QT_LRELEASE Qt6::lrelease IMPORTED_LOCATION)
76
else()
8-
set(QT_LRELEASE "${Qt${QT_VERSION_MAJOR}_LRELEASE_EXECUTABLE}")
7+
set(QT_LRELEASE "lrelease")
98
endif()
109

1110
if(NOT ARGN)

0 commit comments

Comments
 (0)