I am a bit confused regarding cpack_add_component() and various CPACK_COMPONENT_ in comparison to when CPack is included. I am just looking for some clarity here.
It seems that cpack_add_component() essentially defines some CPACK_COMPONENT_. It seems that this cpack_add_component()
cpack_add_component(qwunits_dev
DISPLAY_NAME "QW Units Development"
DESCRIPTION "Development package for QW Units"
DEPENDS qwunits_runtime
Is more or less equivalent to
set(CPACK_COMPONENT_QWUNITS_DEV_NAME qwunits_dev)
set(CPACK_COMPONENT_QWUNITS_DEV_DISPLAY_NAME "QW Units Development")
set(CPACK_COMPONENT_QWUNITS_DEV_DESCRIPTION "Development package for qwunits")
set(CPACK_COMPONENT_QWUNITS_DEV_DEPENDS qwunits_runtime)
In my case I want to rename the debian package file name that gets generated. So, I have a couple of CPACK_DEBIAN_ defines.
set(CPACK_DEBIAN_QWUNITS_DEV_PACKAGE_NAME libqwunits-dev)
set(CPACK_DEBIAN_QWUNITS_DEV_FILE_NAME "libqwunits-dev_${CPACK_DEBIAN_QWUNITS_PACKAGE_VERSION}-${CPACK_DEBIAN_QWUNITS_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
What I have found is that if I try to use cpack_add_component() prior to including CPack I get an error that I can’t use cpack_add_component() until after I include CPack.
If I define the CPACK_DEBIAN_QWUNITS_DEV_FILE_NAME after include CPACK it doesn’t seem to change the file name. So, it appears that CPACK_DEBIAN_ values need to be defined prior to include(CPack).
If I don’t use cpack_add_component() and set the variables directly before including CPack then I do seem to get the file names changed.
#cpack_add_component(qwunits_dev
# DISPLAY_NAME "QW Units Development"
# DESCRIPTION "Development package for QW Units"
# DEPENDS qwunits_runtime
#)
set(CPACK_COMPONENT_QWUNITS_DEV_NAME qwunits_dev)
set(CPACK_COMPONENT_QWUNITS_DEV_DISPLAY_NAME "QW Units Development")
set(CPACK_COMPONENT_QWUNITS_DEV_DESCRIPTION "Development package for qwunits")
set(CPACK_COMPONENT_QWUNITS_DEV_DEPENDS qwunits_runtime)
set(CPACK_DEBIAN_QWUNITS_DEV_PACKAGE_NAME libqwunits-dev)
set(CPACK_DEBIAN_QWUNITS_DEV_FILE_NAME "libqwunits-dev_${CPACK_DEBIAN_QWUNITS_PACKAGE_VERSION}-${CPACK_DEBIAN_QWUNITS_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
include(CPack)
This seems to do what I want and set the filename to what I want.
So, if I want to keep my CPACK_COMPONENT_ definitions and CPACK_DEBIAN_ definitions together I need to set them directly prior to include(CPack) line. I would not be able to use cpack_add_component() unless I put the CPACK_DEBIAN_ definitions prior to include(CPack) and then I could use cpack_add_component() after include(CPack). They could not be put together if I want to use cpack_add_component().
Do I have that correct?
Also, do I have it correct that cpack_add_component just sets the corresponding CPACK_COMPONENT_ values. So I don’t really lose anything by directly setting the CPACK_COMPONENT_ instead of using cpack_add_component()?
Thanks
Chris