<div dir="ltr">Here&#39;s a follow-up.<div><br></div><div>I was unable to get Jean-Christophes modification of Ansis&#39; solution working. (I definitely did not want to repeat the install directives in this rather large project.) The &quot;<span style="font-family:arial,sans-serif;font-size:13px">-DCMAKE_BUILD_TYPE&quot; lines don&#39;t really accomplish anything when building with Visual Studio. I was making progress but ultimately gave up. Here is where I stopped.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">#####</span></div><div><div><span style="font-family:arial,sans-serif">include(ExternalProject)</span><br>
</div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">ExternalProject_Add(MyProjectDebug</font></div><div><font face="arial, sans-serif">  PREFIX Debug</font></div><div><font face="arial, sans-serif">  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}</font></div>
<div><font face="arial, sans-serif">  CMAKE_ARGS -G ${CMAKE_GENERATOR} -D CMAKE_BUILD_TYPE=Debug -D CPACK_BUILD_CONFIG=Debug</font></div><div><font face="arial, sans-serif">  BUILD_COMMAND &quot;${CMAKE_COMMAND}&quot; --build ${CMAKE_BINARY_DIR}/Debug/src/MyProjectDebug-build --config Debug</font></div>
<div><font face="arial, sans-serif">  ) </font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">ExternalProject_Add(MyProjectRelease</font></div><div><font face="arial, sans-serif">  PREFIX Release</font></div>
<div><font face="arial, sans-serif">  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}</font></div><div><font face="arial, sans-serif">  CMAKE_ARGS -G ${CMAKE_GENERATOR} -D CMAKE_BUILD_TYPE=Release -D CPACK_BUILD_CONFIG=Release</font></div>
<div><font face="arial, sans-serif">  BUILD_COMMAND &quot;${CMAKE_COMMAND}&quot; --build ${CMAKE_BINARY_DIR}/Release/src/MyProjectRelease-build --config Release</font></div><div><font face="arial, sans-serif">  ) </font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">set(CPACK_INSTALL_CMAKE_PROJECTS</font></div><div><font face="arial, sans-serif">  &quot;${CMAKE_BINARY_DIR}/Debug/src/MyProjectDebug-build;MyProject;ALL;/&quot;</font></div>
<div><font face="arial, sans-serif">  &quot;${CMAKE_BINARY_DIR}/Release/src/MyProjectRelease-build;MyProject;ALL;/&quot;</font></div><div><font face="arial, sans-serif">)</font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif">include(CPack)</font></div></div><div><font face="arial, sans-serif">#####</font></div><div><br></div><div style><span style="font-family:arial,sans-serif;font-size:13px">At this point, the debug build would build in the debug tree and the release build in the release tree. All is well to that point. However, when I would attempt to use CPack with no -C option it would attempt to package Debug from the Release tree. When I would attempt to use CPack with a -C option, it would fail on one or the other (whichever one I did not specify).</span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">I tried a slight fork of the above using the NMake generator instead of the Visual Studio 10 generator but still ran into some issues local to our CMake files. I may try to resolve that next, but if anybody has any hints of where go from here that would be appreciated.</span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">Frankly it seems to me that we should be able to package multiple configs without any of this extra work.</span></div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 8, 2013 at 2:50 AM, Yngve Inntjore Levinsen <span dir="ltr">&lt;<a href="mailto:yngve.levinsen@gmail.com" target="_blank">yngve.levinsen@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">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
    <br>
    <div>On 7/2/13 7:54 PM, Patrick Johnmeyer
      wrote:<br>
    </div>
    <blockquote type="cite">On Thu, Feb 7, 2013 at 12:41 PM, Yngve Inntjore
      Levinsen <span dir="ltr">&lt;<a href="mailto:yngve.levinsen@gmail.com" target="_blank">yngve.levinsen@gmail.com</a>&gt;</span>
      wrote:<br>
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> I think you are
            fighting the tool in any case, because you are asking to
            build multiple configurations in one build folder (?).
            Normally you would create one build folder per
            configuration.. Which I guess is what you are doing today.<br>
          </div>
        </blockquote>
        <div> </div>
        <div>No, the Visual Studio generator is not a &quot;<i>single-configuration
            generator&quot;</i>. all configurations are bundled into the
          single generated solution file. This is the standard behavior
          of CMake under &quot;basic&quot; usage.</div>
        <div><br>
        </div>
        <div>Your solution using ExternalProject looks promising,
          though, I will try this out. Thanks!</div>
      </div>
    </blockquote></div></div>
    Aha, I have mostly used the Makefile generator, and never VS, so I
    didn&#39;t know that. I agree, the externalproject trick proposed by
    Ansis sounds better. Good luck!<br>
    <br>
    Cheers,<br>
    Yngve<br>
  </div>

</blockquote></div><br></div>