<div dir="ltr">2017-07-22 1:55 GMT+02:00 DKLind <span dir="ltr"><<a href="mailto:davidklind@gmail.com" target="_blank">davidklind@gmail.com</a>></span>:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I have a large project and I need to create a Debian package for each<br>
sub-project (essentially each add_subdirectory).<br>
<br>
I have been experimenting with CPack components as outlined here:<br>
<a href="https://cmake.org/cmake/help/v3.8/module/CPackComponent.html?highlight=cpack_components_grouping#variable:CPACK_COMPONENTS_GROUPING" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/<wbr>v3.8/module/CPackComponent.<wbr>html?highlight=cpack_<wbr>components_grouping#variable:<wbr>CPACK_COMPONENTS_GROUPING</a><br></blockquote><div><br></div><div>Debian packaging generator specific variables are described here:<br><a href="https://cmake.org/cmake/help/v3.8/module/CPackDeb.html">https://cmake.org/cmake/help/v3.8/module/CPackDeb.html</a><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I haven't been able to get any CPACK_DEBIAN_<COMPONENT>_<wbr>PACKAGE_XXX<br>
variables to work. I've been using the syntax<br>
CPACK_DEBIAN_${PROJECT_NAME}_<wbr>PACKAGE_XXX.<br></blockquote><div><br></div><div>I'm guessing that ${PROJECT_NAME} contains lower case characters - <COMPONENT> <code>(called <compName> in documentation) part of the variable name is supposed to be in upper case.</code><code class="gmail-descname"><br></code></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I'm calling install as:<br>
install(TARGETS ${PROGRAM_NAME} DESTINATION lib COMPONENT ${PROGRAM_NAME})<br>
This way each sub-project is a unique component.<br></blockquote><div><br></div><div>This looks fine.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I would expect that CPackConfig.cmake would contain an entry for each<br>
CPACK_DEBIAN_<COMPONENT>_<wbr>PACKAGE_XXX variable. But, I'm seeing only<br>
variables for the last sub-project that called "include(CPack)".<br></blockquote><div><br></div><div>Only the top level CMakeLists.txt should call 'include(CPack)' and the rest of the CMakeLists.txt (if they can be used stand alone) should only call it if they are the base binary dir:<br><br></div><div>if(CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_BINARY_DIR)<br></div><div>    include(CPack)<br></div><div>endif()<br><br></div><div>The reason is that including this script generates CPackConfig.cmake and CPackSourceConfig.cmake files from already set variables.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Here are my requrements:<br>
1. Each package must have a unique control file info (version, description,<br>
etc).<br></blockquote><div><br></div><div>Description part is not a problem but the version part is - currently only one version for all packages is used and can't be set per component. Using ExternalProject instead of subdirectories would be one solution, the other would be extending CPackDeb.cmake module (contribution would be welcome).<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
2. Each package filename must be<br>
${PROGRAM_NAME}_${VERSION}_${<wbr>ARCHITECTURE}.deb<br></blockquote><div><br></div><div>For package names I'd suggest using<code>:<br><br></code><code class="gmail-descname">set(CPACK_DEBIAN_FILE_NAM</code><code class="gmail-descname"></code>E "<code class="gmail-docutils gmail-literal"><span class="gmail-pre">DEB-DEFAULT</span></code>")<br><br></div><div>to get the default deb package file name format but if you wish to use your naming convention you can set the per component version for each package.<br><br></div><div>Regards,<br><br></div><div>Domen<br></div></div></div></div>