Here's a little trick I learned. Executing the custom target, "make package_target target=xyz", will build the target and call cpack to create the package. Additional parameters can be passed by putting the target value in quotes (make package_target target="xyz -j4").
Executing cpack causes the target to be built. But, if you want to see the output of make, before cpack, "COMMAND make ${PARAMS}" will do that. set(PARAMS "$(if $(target),$(target))" ) string(REPLACE " " ";" PARAMS ${PARAMS}) add_custom_target(package_target COMMAND make ${PARAMS} COMMAND cpack -D CPACK_COMPONENTS_ALL=${PARAMS} ) -- View this message in context: http://cmake.3232098.n2.nabble.com/CPack-Create-debian-packge-for-each-sub-project-tp7595889p7595912.html Sent from the CMake mailing list archive at Nabble.com. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake