2019-11-10 22:35:07 +08:00
|
|
|
function(jkqtplotter_deployqt TARGET_NAME)
|
|
|
|
#use windeploy
|
|
|
|
if (WIN32)
|
2022-04-19 05:10:05 +08:00
|
|
|
get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
|
2019-11-10 22:35:07 +08:00
|
|
|
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
|
2022-04-22 19:27:31 +08:00
|
|
|
find_program(WINDEPLOYQT_ENV_SETUP qtenv2.bat HINTS "${_qt_bin_dir}")
|
2019-11-10 22:35:07 +08:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2022-04-22 19:27:31 +08:00
|
|
|
find_program(WINDEPLOYQT_EXECUTABLE NAMES windeployqt.debug.bat HINTS "${_qt_bin_dir}")
|
|
|
|
else()
|
|
|
|
find_program(WINDEPLOYQT_EXECUTABLE NAMES windeployqt HINTS "${_qt_bin_dir}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-11-10 22:35:07 +08:00
|
|
|
# install system runtime lib
|
|
|
|
include( InstallRequiredSystemLibraries )
|
|
|
|
if( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS )
|
|
|
|
install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT System )
|
|
|
|
endif( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS )
|
|
|
|
|
|
|
|
get_filename_component(CMAKE_CXX_COMPILER_BINPATH ${CMAKE_CXX_COMPILER} DIRECTORY )
|
|
|
|
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
|
2022-04-22 19:32:24 +08:00
|
|
|
COMMAND "${WINDEPLOYQT_ENV_SETUP}" && "${WINDEPLOYQT_EXECUTABLE}" \"$<TARGET_FILE:${TARGET_NAME}>\"
|
2019-11-10 22:35:07 +08:00
|
|
|
COMMENT "Running windeployqt ... "
|
|
|
|
)
|
|
|
|
endif(WIN32)
|
2019-11-18 22:59:06 +08:00
|
|
|
endfunction(jkqtplotter_deployqt)
|