[CMake] CPACK_NSIS_EXTRA_PREINSTALL_COMMAND Not Working as Expected

Danoush danoushh at gmail.com
Wed Oct 17 19:07:46 EDT 2012


Thanks for the feedback guys.

I will have a look at this and report back when I have some news.

Dan

On 10/17/2012 4:04 PM, Eric Noulard wrote:
> 2012/10/17 David Cole <david.cole at kitware.com>:
>> Ah, so your project uses components.
>>
>> I haven't tried it with component based installers. Perhaps the preinstall
>> commands need to be put in a place that gets executed before the components
>> are installed. I probably won't be able to investigate this soon myself, but
>> you're on the right track. You'll need to figure out where the "File /r"
>> calls are being made for your components, and put the preinstall commands
>> before those. Unfortunately, the NSIS nsi file is just extremely hard to
>> read and wrap your head around things... Let us know if you figure out the
>> right place to put it to work with a component-based install.
>>
>> (Or maybe somebody listening in here can chime in and give some help...?)
> Dan as pointed out by David you should have a look at the
> expanded projectnsi file and not NSIS.template.in.
>
> However you can have a look at the template in order to know
> which parts get expanded.
>
> In particular the component section, gets expanded from
> "CPACK_NSIS_COMPONENT_SECTIONS"
>
> whereas in a FULL install (without component)
> you get the install command from
> CPACK_NSIS_FULL_INSTALL
> (which is set to File /r \"${INST_DIR}\\*.*\" in )
>
> You can figure that out from the C++ source code of CMake:
> http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/CPack/cmCPackNSISGenerator.cxx;h=b2e57a2b8ed7e1f71e47320fd8f357a5b9406775;hb=HEAD
>
> I don't quite understand the flow of control of the NSIS template
> but the "component sections" seems to be executed before
> "-Core installation" where
> CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS gets executed
> right before "CPACK_NSIS_FULL_INSTALL".
>
> In the component case "CPACK_NSIS_FULL_INSTALL" is "" (empty string)
> but CPACK_NSIS_COMPONENT_SECTIONS is not.
>
> HTH
> Eric
>
>> On Wed, Oct 17, 2012 at 2:46 PM, Danoush <danoushh at gmail.com> wrote:
>>> Hi David,
>>>
>>> Thanks for that explanation. I see what you mean. I see now that "File /r"
>>> does *not* appear after the preinstall command in my NSIS script (please see
>>> attached to confirm my findings).
>>>
>>> Yes, I had played around with the template, but I have now reverted back
>>> to the original template. The issue is still present though. The message box
>>> appears, but *after* files are copied onto the system. For clarity, I tried
>>> this on fresh install (without a previous installation on the machine) with
>>> the same results, i.e. the messagebox is displayed after the files are
>>> copied onto the target.
>>>
>>> p.s. I am using NSIS 2.4.6
>>>
>>> Thanks in advance,
>>> Dan
>>>
>>> On 10/17/2012 1:43 PM, David Cole wrote:
>>>
>>> Your template.in file is modified from what is in CMake. Did you move the
>>> CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS up one line?
>>>
>>> The template.in file is configured at CPack time into a file in your build
>>> tree called "_CPack_Packages\win32\NSIS\project.nsi" -- you'll see the "File
>>> /r" in that file.
>>>
>>> If I add your CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS to the
>>> Tests/Tutorial/Step7/CMakeLists.txt file in the CMake test suite, I see the
>>> message box pop up just where I'd expect it to: on the final screen of the
>>> installer, but before the files are actually installed.
>>>
>>> Are you saying you *never* see the message box appear, or are you just
>>> expecting to see it in an earlier screen?
>>>
>>> What version of NSIS are you using? (I'm using 2.46)
>>>
>>>
>>> David
>>>
>>>
>>> On Wed, Oct 17, 2012 at 10:32 AM, Danoush <danoushh at gmail.com> wrote:
>>>> Hi David,
>>>>
>>>> Thanks for the reply.
>>>>
>>>> I'm do not quite understand your remarks. I cannot find
>>>> "cmCPackNSISGenerator.cxx" in my CMake tree. This may be because I am using
>>>> the binary package of CMake and not building from sources.
>>>>
>>>> Also, I cannot find the string "File /r" in NSIS.template.in (see
>>>> attached file).
>>>>
>>>> Looking forward to your reply.
>>>>
>>>> Regards,
>>>> Dan
>>>>
>>>>
>>>>
>>>> On 10/15/2012 1:21 PM, David Cole wrote:
>>>>> Of course, you must be if you're actually seeing the message box....
>>>>> Never mind my silly question.
>>>>>
>>>>> It looks to me like it should be executed before any installation
>>>>> commands.
>>>>>
>>>>> The variable CPACK_NSIS_FULL_INSTALL is set to "File /r
>>>>> \"${INST_DIR}\\*.*\"" in Source/CPack/cmCPackNSISGenerator.cxx and
>>>>> that should be inserted directly after your extra code.
>>>>>
>>>>> Does the configure NSIS.template file look correct? (i.e. -- is the
>>>>> File /r command after the MessageBox call?)
>>>>>
>>>>>
>>>>> On Mon, Oct 15, 2012 at 1:18 PM, David Cole <david.cole at kitware.com>
>>>>> wrote:
>>>>>> Are you using CMake 2.8.9?
>>>>>>
>>>>>> That variable did not exist prior to 2.8.9.
>>>>>>
>>>>>>
>>>>>> On Mon, Oct 8, 2012 at 12:33 PM, dan h. <danoushh at gmail.com> wrote:
>>>>>>> Any thoughts about this issue?
>>>>>>>
>>>>>>> Regards,
>>>>>>> Dan
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> 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
>>>>
>>>
>>
>> --
>>
>> 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
>
>



More information about the CMake mailing list