Е
if ( WIN32 )
get_target_property( _qmake_executable Qt6::qmake IMPORTED_LOCATION )
get_filename_component( _qt_bin_dir "${_qmake_executable}" DIRECTORY )
function( windeployqt target )
add_custom_command( TARGET ${target} POST_BUILD
COMMAND "${_qt_bin_dir}/windeployqt.exe"
--force
--verbose 1
--release
--dir deploy
--no-system-d3d-compiler
--no-translations
--no-virtualkeyboard
--no-svg
--no-opengl
--no-opengl-sw
--no-winextras
\"$<TARGET_FILE:${target}>\"
COMMAND ${CMAKE_COMMAND} -E copy
\"$<TARGET_FILE:${target}>\"
\"${CMAKE_CURRENT_BINARY_DIR}/deploy/$<TARGET_FILE_NAME:${target}>\"
COMMENT "Deploying Qt libraries using windeployqt for compilation target '${target}' ..."
)
endfunction()
set ( build_with_deploy Release MinSizeRel )
if ( ${CMAKE_BUILD_TYPE} IN_LIST build_with_deploy )
windeployqt(
ИМЯ_ПРОЕКТА )
endif ()
endif ()