<div class="gmail_quote">On Fri, Jul 1, 2011 at 7:23 AM, Glenn Coombs <span dir="ltr">&lt;<a href="mailto:glenn.coombs@gmail.com">glenn.coombs@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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:<br><br><span style="font-family:courier new,monospace">include(ExternalProject)</span><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">ExternalProject_Add(external_proj</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    PREFIX                ${CMAKE_BINARY_DIR}/external_proj</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    SOURCE_DIR            ${CMAKE_SOURCE_DIR}/external/proj/dir</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    CMAKE_ARGS            -DCMAKE_BUILD_TYPE:STRING=Release</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">                          -DMETAGS_DIR=${CMAKE_BINARY_DIR}/meta_install</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    INSTALL_COMMAND        &quot;&quot;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"></span><br>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&#39;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:<br>

<br><span style="font-family:courier new,monospace">Debug:          VCExpress.exe myProj.sln /build Debug          /project external_proj</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
DebugOptimised: VCExpress.exe myProj.sln /build DebugOptimised /project external_proj</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
</span><br>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.  <br>

<br>--<br><font color="#888888">Glenn<br><br>
</font><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br>With Visual Studio builds, external projects get built (by default) with the same configuration as the outer project. If you want a different configuration built, then you will have to customize the BUILD_COMMAND. You can look in the source for ExternalProject.cmake to see how the default BUILD_COMMAND is constructed and go from there.<br>
<br>HTH,<br>David<br><br>