This is the CmakeList.txt for the Debug build:
cmake_minimum_required(VERSION 2.6) PROJECT(MYPROJ) SET(EXTERNALS_DIR D:/code/local/lib) SET(PROJECT_LIB D:/code/MYPROJ/src/lib) # Find ITK. SET(ITK_DIR ${EXTERNALS_DIR}/InsightToolkit-3.12.0/build) # Elastix source SET(ELASTIX_SRC ${EXTERNALS_DIR}/elastix_sources_v4.1/src) # Elastix build SET(ELASTIX_BUILD ${EXTERNALS_DIR}/elastix_sources_v4.1/src/build) FIND_PACKAGE(ITK REQUIRED) IF(ITK_FOUND) INCLUDE(${ITK_USE_FILE}) ENDIF(ITK_FOUND) INCLUDE_DIRECTORIES(${ELASTIX_SRC}) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Common) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Common/ImageSamplers) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Common/xout) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Common/ParameterFileParser) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Common/CostFunctions) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Common/Transforms) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Core) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Core/Install) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Core/Kernel) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Core/Configuration) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Core/ComponentBaseClasses) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Components/ImageSamplers/Random) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Components/Metrics/AdvancedMeanSquares) INCLUDE_DIRECTORIES(${ELASTIX_SRC}/Components/Optimizers/StandardGradientDescent) INCLUDE_DIRECTORIES(${PROJECT_LIB}) INCLUDE_DIRECTORIES(${PROJECT_LIB}/CImg-1.21) INCLUDE_DIRECTORIES(${PROJECT_LIB}/zlib-1.2.3-lib/include) INCLUDE_DIRECTORIES(${PROJECT_LIB}/revised) LINK_DIRECTORIES(${ELASTIX_BUILD}) LINK_DIRECTORIES(${ELASTIX_BUILD}/Components/Optimizers/StandardGradientDescent) LINK_DIRECTORIES(${ELASTIX_BUILD}/Common) LINK_DIRECTORIES(${ELASTIX_BUILD}/Core) ADD_EXECUTABLE(MYPROJ main.cpp ) TARGET_LINK_LIBRARIES(ADAPTIVE ITKCommon ITKAlgorithms ITKBasicFilters ITKNumerics ITKIO ITKBasicFilters StandardGradientDescent elxCommon elxCore) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -lX11 -Dcimg_use_xshm -lXext -Dcimg_use_xrandr -lXrandr -O3 -fpermissive -march=nocona -m64 -ffast-math -funroll-loops -finline-functions") 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. On Mon, Sep 14, 2009 at 10:37 PM, Eric Noulard <eric.noul...@gmail.com> wrote: > 2009/9/14 motes motes <mort.mo...@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 > _______________________________________________ > 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 > _______________________________________________ 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