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

Eric Noulard eric.noulard at gmail.com
Mon Sep 14 16:37:20 EDT 2009


2009/9/14 motes motes <mort.motes at gmail.com>:
> I would like to create a Release and Debug Build for my source files.
> Currently I have been able to make both build types separately but it
> would be nice to not have duplicated source files.
>
> My source files depends on ITK and Elastix. I have therefore made both
> a Debug and Release build for ITK and Elastix.
>
> Now in my source folder I need to create two CMakelist.txt files. One
> that uses the ITK and Elastix Release build and another that uses the
> Debug builds. But how do I make CMake use the right CMakeList.txt
> file?

You should use

1) the debug/optimized etc... flags from
    target_link_libraries

2) may be some IF(CMAKE_BUILD_TYPE STREQUAL "Debug") etc...

If you post here an example of what is different in your currently
separated CMakeLists.txt files we could help you with more
expressive example.

You may browse the ML archive for thread talking about "build type"
like may be this one:
http://www.cmake.org/pipermail/cmake/2007-April/013479.html

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list