Skip to content

Commit 4a0b656

Browse files
authored
Search windeployqt (flameshot-org#4022)
1 parent 3741847 commit 4a0b656

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,19 @@ endif ()
391391

392392
# windeployqt
393393
if (WIN32)
394-
if (EXISTS $ENV{QTDIR}/bin/windeployqt.exe)
394+
# Add CMAKE_PREFIX_PATH to search paths
395+
foreach(prefix ${CMAKE_PREFIX_PATH})
396+
list(APPEND WINDEPLOYQT_SEARCH_PATHS "${prefix}/bin")
397+
endforeach()
398+
list(APPEND WINDEPLOYQT_SEARCH_PATHS "$ENV{QTDIR}/bin")
399+
400+
find_program(WINDEPLOYQT_EXE windeployqt.exe
401+
PATHS ${WINDEPLOYQT_SEARCH_PATHS}
402+
)
403+
404+
if(WINDEPLOYQT_EXE)
405+
message(STATUS "windeployqt found: ${WINDEPLOYQT_EXE}")
406+
395407
if (CMAKE_BUILD_TYPE MATCHES Release)
396408
set(BINARIES_TYPE --release)
397409
else ()
@@ -403,7 +415,7 @@ if (WIN32)
403415
POST_BUILD
404416
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff
405417
COMMAND
406-
$ENV{QTDIR}/bin/windeployqt.exe ${BINARIES_TYPE} --no-translations --compiler-runtime --no-system-d3d-compiler
418+
${WINDEPLOYQT_EXE} ${BINARIES_TYPE} --no-translations --compiler-runtime --no-system-d3d-compiler
407419
--no-quick-import --dir ${CMAKE_BINARY_DIR}/windeployqt_stuff $<TARGET_FILE:flameshot>
408420
# copy translations manually QM_FILES
409421
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff/translations
@@ -429,7 +441,7 @@ if (WIN32)
429441
endif ()
430442

431443
else ()
432-
message("Unable to find executable QTDIR/bin/windeployqt.")
444+
message(WARNING "Unable to find executable windeployqt.")
433445
endif ()
434446
endif ()
435447

0 commit comments

Comments
 (0)