[CMake] Run a command depending on the output of cpack

Benoît Bleuzé benoit.bleuze at 1000shapes.com
Sat Nov 15 14:33:31 EST 2014


Hi list,

Here is my goal:
I would like to create component packages using the archive cpack
generator, to get development packages, run time packages, and some
internal packages (including some additionnal executables not available
to the normal users).

This works fine, I use the COMPONENT install property, I
set(CPACK_ARCHIVE_COMPONENT_INSTALL TRUE), and I define some cpack
components.

I would also like my tar.gz packages to follow my own naming scheme, and
not ${CPACK_PACKAGE_FILE_NAME}-component_name.tar.gz.

I looked at the cpack cpp code, this behaviour is hard coded, so here
are the solutions I saw:
* patch the cpack program, adding some new property in
cpack_add_component(), similarly to the ARCHIVE, knowing that, from what
I understood, this function is not used so far with the ARCHIVE generators.
* run a custom command after the package target has been run, and rename
the tar.gz files that were generated for each component.

I wanted to not spend too much time on this, so I opted for the second
solution. However I don't seem to be able to create a custom command
depending on the target "package".

So my questions are:
1- How would you rename component based archive packages?
2- Is the Package target somehow special and can't be used as a dependency?
3- Is the custom command based on a target dependency a dead end?

4- Bonus question: I will need to include somehow the configuration name
in the package name. On Linux, I can rely on the Build_type, but my
knowledge of configuration on windows is limited, does CMAKE_BUILD_TYPE
mean anything when running cmake custom commands?

Thank you all for you help,
Benoît Bleuzé.





More information about the CMake mailing list