<div dir="ltr">
<p class="">Hello, I have problems reducing available configuration
types for a Visual Studio project.</p>
<p class="">No matter what I do, the project always contains all four
configuration types.</p>
<p class=""> </p>
<p class="">I have two files involved, I tried to strip everything
that seemed to be unimportant:</p>
<p class=""> </p>
<p class="">CmakeLists.txt (Main file):</p>
<p class="">------------------------------------</p>
<p class="">include("... Helpers.cmake")</p>
<p class="">configureMyProject("MyProject")</p>
<p class="">message("Config types (outside):
${CMAKE_CONFIGURATION_TYPES}")</p>
<p class="">------------------------------------</p>
<p class=""> </p>
<p class="">Helpers.cmake:</p>
<p class="">------------------------------------</p>
<p class="">if(__myhelpers)</p>
<p class=""><span style> </span>return()</p>
<p class="">endif()</p>
<p class="">set(__myhelpers YES)</p>
<p class=""> </p>
<p class="">function(configureMyProject MY_NAME ........)</p>
<p class=""><span style>
</span>set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE
STRING "" FORCE)</p>
<p class=""><span style>
</span>message("Config types (before): ${CMAKE_CONFIGURATION_TYPES}")
</p>
<p class=""><span style>
</span>project(${MY_NAME}) </p>
<p class=""><span style>
</span>message("Config types (after): ${CMAKE_CONFIGURATION_TYPES}") </p>
<p class=""><span style>
</span>set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE
STRING "" FORCE) </p>
<p class=""><span style>
</span>message("Config types (after 2):
${CMAKE_CONFIGURATION_TYPES}")</p>
<p class=""><span style> </span>...</p>
<p class=""><span style> </span>add_library(...)</p>
<p class=""><span style> </span>...</p>
<p class="">endfunction()</p>
<p class="">------------------------------------</p>
<p class=""> </p>
<p class="">I then get the following output:</p>
<p class="">------------------------------------</p>
<p class="">Config types (before): Debug;RelWithDebInfo</p>
<p class="">Config types (after):
Debug;Release;MinSizeRel;RelWithDebInfo</p>
<p class="">Config types (after 2): Debug;RelWithDebInfo</p>
<p class="">Config types (outside): Debug;RelWithDebInfo</p>
<p class="">------------------------------------</p>
<p class=""> </p>
<p class="">So it seems to me, that the call of the project-function
resetted the configuration types and created then the project accordingly.</p>
<p class="">Is this a bug or am I doing something wrong? Does anyone
know a workaround?</p>
<p class=""> </p>
<p class="">Kind regards</p>
<p class="">Janosch Scharlipp</p>
</div>