[CMake] Fwd: Configuring CPack to Build Packages My Way

Eric Noulard eric.noulard at gmail.com
Mon Sep 23 08:25:39 EDT 2013


Forgot the ML myself sorry.

---------- Forwarded message ----------
From: Eric Noulard <eric.noulard at gmail.com>
Date: 2013/9/23
Subject: Re: [CMake] Configuring CPack to Build Packages My Way
To: "Stewart, Robert" <Robert.Stewart at sig.com>


Hi Rob,

Please do not drop the ML address unless you really need private com'.


2013/9/23 Stewart, Robert <Robert.Stewart at sig.com>:
> Eric Noulard wrote:
>> 2013/9/13 Stewart, Robert <Robert.Stewart at sig.com>:

[...]

>> I have several question:
>>
>> Q1) Do all your install(... DESTINATION relpath/to/install)
>> have relative path destination or not?
>
> All relative.

I have some doubt, could give us at least a couple of example
of your
install(... DESTINATION ..)

command taken from your CMakeLists.txt

> The tar.gz contains files with pathnames like the following (I substituted the variables that affect the different parts of the pathname):
>
> ${CPACK_PACKAGE_FILE_NAME}/${CMAKE_INSTALL_PREFIX}/lib/debug/libsomething.a

CMAKE_INSTALL_PREFIX, shouldn't be there **AT ALL** unless you either

1) use something like:
    install(TARGET <targetname> DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
    which is wrong.

2) set CPACK_SET_DESTDIR
    see: --help-variable CPACK_SET_DESTDIR

> What I want is the following:
>
> installed/other/directories/lib/debug/libsomething.a
>
> (I set CMAKE_INSTALL_PREFIX to ${CMAKE_SOURCE_DIR}/installed/other/directories so the desired structure appears within my build tree.)
>
> Extracting into a directory will then recreate "installed" and its subdirectories right in that directory instead of creating all directories from CMAKE_SOURCE_DIR and then "installed" and its subdirectories.

If you want that then you should do:

install(TARGET <libtargetname> DESTINATION installed/other/directories/lib)

>> With the "archive" generator like TGZ you may play with:
>>
>> CPACK_INCLUDE_TOPLEVEL_DIRECTORY
>
> Setting that to FALSE removed ${CPACK_PACKAGE_FILE_NAME} from
> the front.  That's a good start.  I still need to remove more,
> because CMAKE_INSTALL_PREFIX contains things like my home
> directory in it.  Effectively, I want the content relative to
> CMAKE_SOURCE_DIR.

Yes I got that now.
I'm pretty sure it works.

Could you tell us which version of cmake/cpack you use?
i.e.

cmake --version
cpack --version

>> cpack --help-variable CPACK_PACKAGE_INSTALL_DIRECTORY
>> cpack --help-variable CPACK_PACKAGING_INSTALL_PREFIX
>> cpack --help-variable CPACK_NSIS_INSTALL_ROOT
>
> I'm already using those variables.

And then, what value do they currently have?

>> If you have more question please give us a
>> non-working complete but minimal example to play with.
>
> I'll have to unroll some of the logic now in functions, but I'll
> work on that.
>
> Thanks for your help so far.

You're welcome.


-- 
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org


More information about the CMake mailing list