[CMake] External_Project_Add() and custom build configurations ?

Glenn Coombs glenn.coombs at gmail.com
Fri Jul 1 07:23:40 EDT 2011


I have just started using some externally supplied cmake projects in my
cmake project.  To do this I added these lines to my top level
CMakeLists.txt file:

include(ExternalProject)

ExternalProject_Add(external_proj
    PREFIX                ${CMAKE_BINARY_DIR}/external_proj
    SOURCE_DIR            ${CMAKE_SOURCE_DIR}/external/proj/dir
    CMAKE_ARGS            -DCMAKE_BUILD_TYPE:STRING=Release
                          -DMETAGS_DIR=${CMAKE_BINARY_DIR}/meta_install
    INSTALL_COMMAND        ""
)

And that worked very well.  Inside Visual Studio when I build my project it
automatically runs the cmake configure step for the external projects and
builds them as well.  The problem I have just discovered is when using a
build configuration other than the default ones.  I can build Debug and
Release configurations fine.  My project also has a DebugOptimised
configuration but the external projects don't.  When I try to build my
project it fails to build the external projects.  I used build_command() to
see what commands would be used to build each configuration and I can see
the cause of the problem:

Debug:          VCExpress.exe myProj.sln /build Debug          /project
external_proj
DebugOptimised: VCExpress.exe myProj.sln /build DebugOptimised /project
external_proj

Is there a way to tell cmake how to map my build configurations onto those
that an external project has ?  In this case I would like to build the
external project as Debug when I am building my project as DebugOptimised.

--
Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110701/363d00bc/attachment.htm>


More information about the CMake mailing list