[CMake] CPack with ExternalProjects

Zac Bergquist zbergquist99 at gmail.com
Fri Feb 12 10:51:12 EST 2016


Hello,

I have a CMake project that uses CPack to generate a tgz file.  When I
build it and run CPack, it produces project-X.Y.Z in the build directory
(where X, Y, and Z are ${CPACK_PACKAGE_VERSION_MAJOR}/minor/patch).

I recently decided to add a new "super project" that builds both my project
and a few other external projects.  In a new top-level CMakeLists.txt file
I have:

project(super)
cmake_minimum_required(VERSION 3.1)

# build my project
ExternalProject_Add(my_project
   SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/my_project
   BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/my_project
   BUILD_COMMAND ${CMAKE_COMMAND} --build .
   INSTALL_COMMAND ${CMAKE_CPACK_COMMAND})

# Build another custom target
add_custom_target(custom ALL
   WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/custom
   COMMAND make
)

The super project, works well.  It does build both my original project (via
external project) and another item by invoking make with add_custom_target.

I would like to generate a tgz file that contains both the output of my
custom target and the output of running CPack on my external project, but
can't figure out how to do so.  I've tried to use CPack again (one level
higher) or just forego CPack and manually create a tar file, but both
approaches led to new challenges.  Is there some way to generate a new
package containing the output of an external project?

Thanks for any help,
Zac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160212/e1681f4b/attachment-0001.html>


More information about the CMake mailing list