After a lot of trial and error and some rtfm work, I figured out a way to do it. The UpgradeDLL macro I mentioned below appears to be out of date and the preferred method is now InstallLib. It appears to handle DLL versioning and usage counting. Note: I could be wrong, I've been at this problem for about a day now.
Here's the hack solution I came up with: 1. Modify NSIS.template.in to include Library.nsh: !include Library.nsh 2. Do the following in CMakeLists.txt: install (FILES driver.dll DESTINATION sysdir/) #lots of string escaping, bleccch. NSIS uses the same ${xxx} variable syntax as cmake #note: this is a hack since INST_DIR is a !define inside NSIS.template.in that gets set to CPACK_TEMPORARY_DIRECTORY set (tmp_nsis_inst_dir "\\\${INST_DIR}") set (tmp_nsis_localdll "\\\${localdll}") set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS " !define localdll \\\"${tmp_nsis_inst_dir}\\\\sysdir\\\\driver.dll\\\" !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED \\\"${tmp_nsis_localdll}\\\" \\\"$SYSDIR\\\\driver.dll\\\" \\\"$SYSDIR\\\" !undef localdll ") If anyone could offer up a better solution, I'd greatly appreciate it. Hope this helps someone else out there in the wonderful world of cmake. -James From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of James Zipperer Sent: Thursday, December 17, 2009 4:00 PM To: CMake mailing list Subject: Re: [CMake] using cmake to install dlls into windows/system32 Is there a way to add an NSIS macro or override the NSIS template or something to allow inclusion of the UpgradeDLL macro? With that functionality I think I could achieve my goal. Thanks! -James From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of James Zipperer Sent: Thursday, December 17, 2009 2:44 PM To: CMake mailing list Subject: Re: [CMake] using cmake to install dlls into windows/system32 This seems to work, although I don't think it's the ideal solution: CMakeLists.txt install (FILES drivers/driver.dll DESTINATION sysdir/) set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CopyFiles \\\"$INSTDIR\\\\sysdir\\\\driver.dll\\\" \\\"$SYSDIR\\\" ") This gets the dll into the windows system directory, but there are still some issues I'm sorting through: Versioning of the dll: what if the file was already there and there is already a newer version? How to uninstall only if nothing else is using the dll. It appears that nsis has some helper functions: UpgradeDLL, AddSharedDLL, but I'm not sure yet how to include/call them through CMakeLists.txt. Does anyone have any insight? Thanks! -James From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of James Zipperer Sent: Wednesday, December 16, 2009 4:44 PM To: David Cole; CMake mailing list Subject: Re: [CMake] using cmake to install dlls into windows/system32 They're device driver dlls for use system-wide. -James From: David Cole [mailto:david.c...@kitware.com] Sent: Wednesday, December 16, 2009 4:34 PM To: James Zipperer Cc: CMake mailing list Subject: Re: [CMake] using cmake to install dlls into windows/system32 What's the reason they need to be there? On Wed, Dec 16, 2009 at 7:18 PM, James Zipperer <james.zippe...@modsystems.com<mailto:james.zippe...@modsystems.com>> wrote: Yes, unfortunately they need to be there. -James From: David Cole [mailto:david.c...@kitware.com<mailto:david.c...@kitware.com>] Sent: Wednesday, December 16, 2009 4:15 PM To: James Zipperer Cc: CMake mailing list Subject: Re: [CMake] using cmake to install dlls into windows/system32 You should avoid this if at all possible. Install dlls next to your program, not in the system32 directory. Do you have a reason you need to install a dll there? On Wed, Dec 16, 2009 at 6:42 PM, James Zipperer <james.zippe...@modsystems.com<mailto:james.zippe...@modsystems.com>> wrote: Does anyone have an example of how to install dlls into %WINDIR%/system32 using cmake/ cpack/nsis? Thanks! -James ________________________________ This message contains information which is confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. _______________________________________________ Powered by www.kitware.com<http://www.kitware.com> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake ________________________________ This message contains information which is confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. ________________________________ This message contains information which is confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. ________________________________ This message contains information which is confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. ________________________________ This message contains information which is confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. ________________________________ This message contains information which is confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message.
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake