aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-10-27 22:48:39 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-10-27 22:52:29 +0200
commit8c80aa9da2623127394cf07c3bda5ef3a5c8b659 (patch)
tree162ec550805658dbf4f2890b9b7d3d3197ec0640 /CMakeLists.txt
parent9aa26e2807ed3aebf336139067069e55582a6d6e (diff)
downloadtdv-8c80aa9da2623127394cf07c3bda5ef3a5c8b659.tar.gz
tdv-8c80aa9da2623127394cf07c3bda5ef3a5c8b659.tar.xz
tdv-8c80aa9da2623127394cf07c3bda5ef3a5c8b659.zip
CMakeLists.txt: configure NSIS
- Install a link to sdgui to the Start Menu. - Associate the .ifo file extension with sdgui. - Change the installation directory name to contain a space, rather than a dash, since that appears to be the norm. It's also copied over to the display name. And thus, the GUI has become somewhat usable on Windows.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt20
1 files changed, 19 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25981b7..f566cd0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -365,9 +365,27 @@ set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set (CPACK_GENERATOR "TGZ;ZIP")
set (CPACK_PACKAGE_FILE_NAME
"${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
-set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${PROJECT_VERSION}")
+set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION}")
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
+# XXX: It is still possible to install multiple copies, making commands collide.
+set (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
+set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME}")
+
+set (CPACK_NSIS_INSTALLED_ICON_NAME sdgui.exe)
+set (CPACK_PACKAGE_EXECUTABLES sdgui sdgui)
+set (CPACK_NSIS_EXECUTABLES_DIRECTORY .)
+set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS [[
+ WriteRegStr HKCR '.ifo' '' 'sdgui.Dictionary'
+ WriteRegStr HKCR 'sdgui.Dictionary' '' 'StarDict Dictionary'
+ WriteRegStr HKCR 'sdgui.Dictionary\\shell\\open\\command' '' '\"$INSTDIR\\sdgui.exe\" \"%1\"'
+ System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)'
+]])
+set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS [[
+ DeleteRegKey HKCR 'sdgui.Dictionary'
+ System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)'
+]])
+
include (CPack)