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

norulez at me.com norulez at me.com
Mon May 21 14:22:23 EDT 2012


I think one solution could be that the files must be copied with add_custom_command's, then run configure_file with the NSIS template to be able to use @ variables and then another add_custom_command to run NSIS.

Is there maybe a simpler solution or is this the correct way?


Am 21.05.2012 um 20:05 schrieb norulez at me.com:

> 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?
> 
> Sorry, for simple installers the default NSIS template is great, but for customized ones it seems to be very difficult, isn't it?
> 
> 
> 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
>> 
> --
> 
> 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/297527b6/attachment-0001.htm>


More information about the CMake mailing list