[CMake] CPack: Project and independent subproject

Romain LEGUAY romain.leguay at gmail.com
Mon Oct 22 11:46:00 EDT 2012


Hello everyone,

My c++ project contains a Library folder, an Applications folder and a 
Demos folder like this:

Project/
          |-> Library/
                          |-> include/
                          |-> src/
          |-> Applications/
                          |-> appliA/
                                         |-> include/
                                         |-> src/
                          ...
          |-> Demos/
                          |-> demoA/
                                         |-> include/
                                         |-> src/
                          ...

The applications and demos use the Library (which is a static library).

I can build all the application correctly in different level (directly 
inside demoA/ for example or in Project/).
I create custom target to build my package: demoA-package, 
demoA-package_source ....

My problem is when I want to create a package (tar.gz, dmg, nsis or 
others...), I can't figure how to put just the executable of demosA 
inside the package: I have all the executable and the library.

This is a part of my CMakeLists.txt:

    install(TARGETS ${PROJECT_NAME}
               DESTINATION "Demos"
               COMPONENT ${PROJECT_NAME})

    set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
    set(CPACK_PACKAGE_VENDOR "Me")
    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Example test framework: demos
    ${PROJECT_NAME}")
    set(CPACK_PACKAGE_VERSION_MAJOR "1")
    set(CPACK_PACKAGE_VERSION_MINOR "0")
    set(CPACK_PACKAGE_VERSION_PATCH "0")
    set(CPACK_PACKAGE_VERSION
    "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
    set(CPACK_SOURCE_IGNORE_FILES
    "/bin/;/.svn/;/.git/;${CPACK_SOURCE_IGNORE_FILES}")

    set(CPACK_OUTPUT_CONFIG_FILE
    "${CMAKE_CURRENT_BINARY_DIR}/CPackConfig.cmake")
    set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
    "${CMAKE_CURRENT_BINARY_DIR}/CPackSourceConfig.cmake")

    add_custom_target(${PROJECT_NAME}-package "cpack" "--config"
    "${CPACK_OUTPUT_CONFIG_FILE}")
    add_custom_target(${PROJECT_NAME}-package_source "cpack" "--config"
    "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}")

    include(CPack)

    cpack_add_component(${PROJECT_NAME}
                         DISPLAY_NAME "${PROJECT_NAME}")

I searched some methods to put the wanted files inside a package but I 
only found how to ignore some files.

Does anyone have those kind of problem?

Thanks,
Romain





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121022/93b165c2/attachment.htm>


More information about the CMake mailing list