[CMake] CPack: Installing applications in separate folders (NSIS)

David Cole david.cole at kitware.com
Mon May 21 14:20:18 EDT 2012


On Mon, May 21, 2012 at 2:05 PM, <norulez at me.com> wrote:

> But what about other systems like linux. If I have an executable and
> shared libraries for example.
> Then it is possible to install it under /opt/myproject, but it is not
> possible to install the executable under /usr/bin and the shared libraries
> under /usr/lib? Or did I misunderstood something?
>

But you don't build an NSIS installer based on those.



>
> Sorry, for simple installers the default NSIS template is great, but for
> customized ones it seems to be very difficult, isn't it?
>

Yes, you're correct. It takes some effort if you are not installing
everything underneath the directory that the end user chooses for your
final location.

It's quite good for "simple installers" and "component-based installers" --
beyond that, and especially putting things outside the location chosen by
the end user ... you're on your own.



>
>
> Best Regards
>
> Am 21.05.2012 um 19:27 schrieb David Cole <david.cole at kitware.com>:
>
> The install rule:
>
>   install(FILES ${CMAKE_SOURCE_DIR}/somefolder/myfile.txt DESTINATION
> $CustomDir)
>
> doesn't make sense because $CustomDir is not known at CMake-time or even
> at build-time or install-time. It's not known except to NSIS at packaging
> time.
>
> make install runs before NSIS runs.
>
> Sounds like you need a completely custom installer -- if you have
> installed files that are not contained within the make install tree prefix,
> then you cannot use the recursive "install all files from one root"
> technique in the NSIS script that CPack uses by default.
>
>
> We generally encourage and expect a "re-locatable" install tree to be used
> with the CPack built NSIS installers. (i.e. -- no matter where the end-user
> finally installs your package, they will be able to run the installed
> programs just fine.) That's why the entire install tree is copied using the
> following:
>
>   this->SetOptionIfNotSet("CPACK_NSIS_FULL_INSTALL",
>                             "File /r \"${INST_DIR}\\*.*\"");
>
> That results in the following generated in project.nsi:
>
>   File /r "${INST_DIR}\*.*"
>
> which installs all files and directories recursively (from your make
> install tree) to the installation directory chosen by the end user of your
> installation program.
>
>
> This stuff is not easy, especially when we can't see your code.
>
> Cheers, (& good luck),
> David
>
>
> On Mon, May 21, 2012 at 12:39 PM, NoRulez <norulez at me.com> wrote:
>
>> Hi,
>>
>> I know that the install commands collect files and copy them into the
>> temporary cpack directory for the specified generator.
>> How is it possible to install an application for example into those
>> folders:
>> C:\myapp
>> C:\somefolder
>>
>> I defined 'Var CustomDir="C:\somefolder"' in the NSIS template.
>>
>> When I then use the following in the CMakeLists.txt:
>> install(FILES ${CMAKE_SOURCE_DIR}/somefolder/myfile.txt DESTINATION
>> $CustomDir)
>>
>> Then the files are installed in
>> _CPACK_PACKAGES/NSIS/myproject_1.0.0.1/$CustomDir.
>> The generated project.nsi has the content: $INSTDIR\$CustomDir\...
>>
>> How can I avoid that $INSTDIR\ is added, or did I need to use the
>> install command in a different way?
>>
>> Thanks in advance
>>
>> Best Regards
>> NoRulez
>>
>> --
>>
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120521/fc591d11/attachment.htm>


More information about the CMake mailing list