[CMake] ExternalProject + PREFIX + CPACK - cannot get the good path

Alfred Sawaya alfred at huji.fr
Tue Jul 18 05:03:02 EDT 2017


Bonjour Eric,

Thank you for you answer.



> e.g. note that with your current setup if you do:
> DESTDIR=/tmp make package
>
> you get what you want in the DEB file.
>

Yes, it works.


>
>> I see only one solution to this issue: actually set a prefix on the
>> external project and implement a boolean variable
>> CPACK_IGNORE_INSTALL_PREFIX to remove it into the package. I tihnk it is
>> the most consistent way to resolve this ?
>>
>
> I would say you should find a way to have 2 differents prefixes.
>
> The first should be used when doing "make"
> The second one used when cpack runs.
>

An option like "CMAKE_ONLY_PREFIX" in the ExternalProject ?

A third solution could be:
An option like "CPACK_OVERRIDE_DEST_DIR" could detect if 'DESTDIR=' is
issued in the INSTALL_COMMAND of the external project. If the option is
true, it overrides it with the CPACK_INSTALL_PREFIX.


> All that said, may be you can "simply" craft an install_command script you
> can call in the
> INSTALL_COMMAND argument of ExternalProject_Add and which verifies if
> DESTDIR is already set or not
> in order to call "make install" or "DESTDIR=/choose/your/path make
> install".
>
> However this is kind of workaround to throw away the first install step
> done when doing make while keeping the second one done by cpack...
>

Actually it would work for me as I do not use the first make install. It is
the same as DESTDIR=/tmp make package, but integrated into the CMakeLists.


> Which makes me think, if you primary goal is to package an external
> project, wouldn't it be simpler to add support for a "PACKAGE" step to
> ExternalProject ? Or is this external project meant to be packaged in the
> same package as the project using it?
>

I cannot add a package step as the external project do not support
packaging, it is only a configure / make / make install project. That is
why I use CPack.
But I package it as a separate package.


Anyway, the DESTDIR=/tmp make package does the trick for me but I still can
implement an integrated solution if it is useful for others ?


>
> --
> Eric
>
> --
Cordialement,
Alfred Sawaya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170718/c6149894/attachment.html>


More information about the CMake mailing list