[CMake] CPack/NSIS multiple component intall location
Eric Noulard
eric.noulard at gmail.com
Tue Apr 23 16:09:38 EDT 2013
2013/4/23 Romuald Delmont <romualddelmont at gmail.com>:
> Hi Erik
>
> This is a simplified view of my project:
>
> Root CMakeList:
>
> PROJECT (Foo)
>
> FOREACH( mysubdirs
> Apps
> Data
> )
>
> SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Foo")
> SET(CPACK_NSIS_COMPONENT_INSTALL ON)
> include(CPACK)
>
>
> Apps CMakeList:
>
> set(TARGET_NAME Apps)
>
> # Build some stuff ...
>
> install(TARGETS Apps
> RUNTIME DESTINATION Apps
> )
>
>
>
> Data CMakeList:
>
> set(TARGET_NAME Data)
>
> # Build some stuff to OUTPUT_FILES
>
> install(FILES ${OUTPUT_FILES}
> DESTINATION Data
> )
There is no COMPONENT in your "install" you should have something like
install(FILES ${OUTPUT_FILES}
DESTINATION Data
COMPONENT Data
)
> On Win7, Data should be on ProgramData\Foo and Apps should be on
> ProgramFiles\Foo
Ok I realize now, you want a different **prefix** for each component
not a subdir.
I don't think it's currently possible with NSIS.
Even if NSIS supports COMPONENTized install I don't think
there is currently a way to have different prefix for each component.
> Is there a way to set the install directory (as
> CPACK_PACKAGE_INSTALL_DIRECTORY does) by component to achieve this.
No I don't think so at least not with NSIS.
Archive component like ZIP, TGZ etc... may produce one file per-component
so that you may eventually trick them to make the PREFIX vary for each one
(and I never tried).
> I wish i can do this without breaking into NSIS.template.in.
I think you'll have to do that.
or build two separate NSIS pacjages by calling CPack twice:
1) Build the Data package
cpack -G NSIS -D CPACK_COMPONENTS_ALL=Data -D
CPACK_PACKAGE_INSTALL_DIRECTORY="ProgramData"
2) Build the Program package
cpack -G NSIS -D CPACK_COMPONENTS_ALL=Program -D
CPACK_PACKAGE_INSTALL_DIRECTORY="ProgramFile"
with this your get two NSIS installer each with their own prefix.
**YOU HAVE TO use the **COMPONENT** argument in your install statement**
I know this may not be satisfactory but this is the only way I imagine:
1) hack NSIS.template.in
(and may be some part of Source/CPack/cmCPackNSISGenerator.cxx as well)
2) Build two separate package.
>>
>> 2013/4/23 Romuald Delmont <romualddelmont at gmail.com>:
>> > Hi All
>> >
>> > I'm packaging an application with CMake/Cpack/NSIS and it's going pretty
>> > well except for one point.
>> >
>> > I have a core component with executables and a data component. Both are
>> > built by CMake and have an INSTALL command.
>> > Install target gives me 2 directories (Apps and Data) in the
>> > CMAKE_INSTALL_PREFIX directory which is fine.
>> >
>> > With CPack/Nsis, I try to install them in 2 different locations like
>> > ProgramFiles for Core and ProgramData for Data, but I cannot find a way
>> > to
>> > do this.
>>
>> Do you mean that it works when building INSTALL target but it doesn't
>> when building NSIS installer with CPack?
>>
>> Could you give us the **exact**
>> install(TARGET ...)
>>
>> statement you use for each target.
>>
>> > Is there a way to specify an install destination by component?
>>
>> DESTINATTION is attached to an install(...) statement
>> such as COMPONENT.
>>
>> If you have two different components then each of them
>> should appear in separate install(...), each one having
>> its DESTINATION argument as well.
>>
>> Dis you try to build a componentized ZIP and see what happen?
>> --
>> Erk
>> Le gouvernement représentatif n'est pas la démocratie --
>> http://www.le-message.org
>
>
--
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
More information about the CMake
mailing list