[CMake] CPack: Packaging debug and release configurations in a single zip

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Thu Feb 7 13:49:29 EST 2013


The approach suggested by Ansis looks interesting. Instead of using
"install(FILES ...), you could use CPACK_INSTALL_CMAKE_PROJECTS [1][2]. For
an example, see [3] and [4]

[1]
http://www.cmake.org/cmake/help/v2.8.8/cpack.html#variable:CPACK_INSTALL_CMAKE_PROJECTS
[2] http://www.cmake.org/Wiki/CMake:CPackConfiguration
[3]
https://github.com/Slicer/Slicer/blob/master/CMake/SlicerCPack.cmake#L17-36
[4]
https://github.com/Slicer/Slicer/blob/master/CMake/SlicerBlockInstallCMakeProjects.cmake



if(${CMAKE_BUILD_TYPE STREQUAL DebugAndRelease)
    include(ExternalProject)
    ExternalProject_Add(MEDEBUG
        CMAKE_FLAGS -DCMAKE_BUILD_TYPE Debug)
    ExternalProject_Add(MERELEASE
        CMAKE_FLAGS -DCMAKE_BUILD_TYPE Release)

    set(CPACK_INSTALL_CMAKE_PROJECTS .... )  # <------------------------

    #etc, etc.
    return()
endif()

Hth
Jc


On Thu, Feb 7, 2013 at 1:41 PM, Yngve Inntjore Levinsen <
yngve.levinsen at gmail.com> wrote:

>  Hi,
>
> I think you are fighting the tool in any case, because you are asking to
> build multiple configurations in one build folder (?). Normally you would
> create one build folder per configuration.. Which I guess is what you are
> doing today.
>
> Instead of specifying the compile flags manually you can instead use the
> variables ${CMAKE_C_FLAGS_RELEASE} and ${CMAKE_C_FLAGS_DEBUG},
> and you could set it so it only builds the second target based on an
> option:
>
> option(BUILD_BOTH_LIBVERSIONS "Build both debug and optimized library" OFF)
>
> if(BUILD_BOTH_LIBVERSIONS)
> add_library(...)
> set_target_properties(...)
> set_target_properties(...)
> install(...)
> endif()
>
> Cheers,
> Yngve
>
>
> On 02/07/2013 07:26 PM, Patrick Johnmeyer wrote:
>
> On Thu, Feb 7, 2013 at 3:12 AM, Yngve Inntjore Levinsen <
> yngve.levinsen at gmail.com> wrote:
>
>>  Did you try to create two targets and add per-target compile flags?
>>
>>
>  What you suggest is replacing configurations with targets. That may be
> possible, but runs counter to how CMake natively works. I feel like I
> would be fighting the tool to do it this way.
>
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130207/a0ef1727/attachment-0001.htm>


More information about the CMake mailing list