[CMake] Release and Debug build for same source folder?

motes motes mort.motes at gmail.com
Tue Sep 15 04:51:57 EDT 2009


I build the Debug and Release build the same way with cmake. Its first
when I open the .snl project in Visual Studio 2008 that I choose to
build it either with Release or Debug mode.

But as I understand your mail I have to move this responsibility to cmake?



On Tue, Sep 15, 2009 at 9:53 AM, Eric Noulard <eric.noulard at gmail.com> wrote:
> 2009/9/14 motes motes <mort.motes at gmail.com>:
>> This is the CmakeList.txt for the Debug build:
> [...]
>>
>> # Find ITK.
>> SET(ITK_DIR ${EXTERNALS_DIR}/InsightToolkit-3.12.0/build)
>>
>> # Elastix build
>> SET(ELASTIX_BUILD ${EXTERNALS_DIR}/elastix_sources_v4.1/src/build)
>
> [...]
>
>>
>> The CMakeList.txt for the Release build is the same except from these lines:
>>
>> SET(ITK_DIR ${EXTERNALS_DIR}/InsightToolkit-3.12.0/buildRelease)
>>
>> # Elastix build
>> SET(ELASTIX_BUILD ${EXTERNALS_DIR}/elastix_sources_v4.1/src/buildRelease)
>>
>> So its basically just two lines thats different between the two
>> CMakeList.txt files, but I still need to build my project with CMake
>> (and replace the correct CMakeList.txt file) each time I will change
>> from Debug to Release or the other way around.
>
> Then following your way it should be enough to do define
> ITK_DIR and ELASTIX_BUILD depending on CMAKE_BUILD_TYPE, which
> should be something like:
>
> IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
>    SET(ITK_DIR ${EXTERNALS_DIR}/InsightToolkit-3.12.0/build)
>    SET(ELASTIX_BUILD ${EXTERNALS_DIR}/elastix_sources_v4.1/src/build)
> ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug")
>
> IF (CMAKE_BUILD_TYPE STREQUAL "Release")
>    SET(ITK_DIR ${EXTERNALS_DIR}/InsightToolkit-3.12.0/buildRelease)
>    SET(ELASTIX_BUILD ${EXTERNALS_DIR}/elastix_sources_v4.1/src/buildRelease)
> ENDIF (CMAKE_BUILD_TYPE STREQUAL "Release")
>
> However since ITK and may be ELASTIX seems to be build with CMake
> you should have look at:
> http://www.itk.org/Wiki/CMake:ExportInterface
>
> which may be a better way to use "external" libraries.
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
> _______________________________________________
> 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
>


More information about the CMake mailing list