<div dir="ltr">How about something like this:<div><br></div><div>if(${CMAKE_BUILD_TYPE STREQUAL DebugAndRelease)<br></div><div>    include(ExternalProject)</div><div>    ExternalProject_Add(MEDEBUG</div><div>        CMAKE_FLAGS -DCMAKE_BUILD_TYPE Debug)</div>


<div>    ExternalProject_Add(MERELEASE</div><div>        CMAKE_FLAGS -DCMAKE_BUILD_TYPE Release)</div><div>    install(FILES ...)</div><div>    #etc, etc.</div><div>    return()</div><div>endif()</div><div style># the usual build code comes after</div>

<div><div>
<br></div></div><div>That is, add a new special build type, that, when built, makes the project just build itself twice as an external project, package it up, and exit before the normal build code.</div></div>