diff options
author | Louie S <louie@example.com> | 2024-04-25 17:48:34 -0400 |
---|---|---|
committer | Louie S <louie@example.com> | 2024-04-25 17:48:34 -0400 |
commit | 4621f2a8d7ff5772931fb67b21c9eb1a7fcd2636 (patch) | |
tree | 05726bb7887e380678614c7a2a0b39a6e63b85f3 | |
parent | 0c7266881c346ae15f540e0b805ce4a8fd29f064 (diff) |
Call windeployqt for NSIS postbuild
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cda097..dca866d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,11 +121,11 @@ set_target_properties(assignment-list PROPERTIES WIN32_EXECUTABLE ON) target_link_libraries(assignment-list ${qt_libraries}) # Installation +include(GNUInstallDirs) install(TARGETS assignment-list) # install desktop entry and icon if(CMAKE_SYSTEM MATCHES "Linux.*") - include(GNUInstallDirs) configure_file(data/assignment-list.desktop.in ${CMAKE_CURRENT_SOURCE_DIR}/data/assignment-list.desktop @ONLY) install(FILES data/assignment-list.desktop DESTINATION share/applications) install(FILES data/assignment-list.svg DESTINATION share/pixmaps) @@ -145,6 +145,21 @@ set(CPACK_SOURCE_IGNORE_FILES "/\.git.*;/\.cache;/build;/compile_commands\.json$ # CPack NSIS configuration set(CPACK_NSIS_DEFINES "RequestExecutionLevel user") +# Based on https://stackoverflow.com/q/69139412 +if(CMAKE_SYSTEM MATCHES "Windows*") + include(InstallRequiredSystemLibraries) + find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}") + add_custom_command(TARGET assignment-list POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/qtDeploy/ + COMMAND ${WINDEPLOYQT_EXECUTABLE} + --dir ${CMAKE_BINARY_DIR}/qtDeploy $<TARGET_FILE:assignment-list> + ) + install( + DIRECTORY ${CMAKE_BINARY_DIR}/qtDeploy/ + DESTINATION ${CMAKE_INSTALL_BINDIR} + FILES_MATCHING_PATTERN "*.*" + ) +endif() # CPack Deb configuration set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) |