<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><div><div><div>Hello Eric,<br></div>thanks for your reply, i tried this, but in my case it doesn't work. I made a function that first sets the configuration types (using your line of code) and then calls the project function. Using this function instead of the project function itself, still all configurations are beeing generated.<br>
</div>I browsed through the cmake sources and modules, but i coudn't find the place that reintroduces those configurations.<br></div>It looks like a bug to me, later on i will try to produce an example.<br><br></div>
Kind regards<br>
Janosch<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 28, 2013 at 10:01 PM, Eric Clark <span dir="ltr"><<a href="mailto:eclark@ara.com" target="_blank">eclark@ara.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Our projects limit the types to just Debug and Release. However, what I found was that you had to set the variable before every call to project(…). What we
did was we created a module called BuildTypes.cmake and include it first thing in every list file. The file has one line of code in it that looks like this:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE TYPE INTERNAL FORCE)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This does the trick for us. Hope this helps…<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Eric<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a> [mailto:<a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a>]
<b>On Behalf Of </b>gaga bla<br>
<b>Sent:</b> Tuesday, May 28, 2013 12:55 PM<br>
<b>To:</b> <a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a><br>
<b>Subject:</b> [CMake] Problems setting CMAKE_CONFIGURATION_TYPES for Visual Studio<u></u><u></u></span></p><div><div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hello, I have problems reducing available configuration types for a Visual Studio project.<u></u><u></u></p>
<p class="MsoNormal">No matter what I do, the project always contains all four configuration types.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I have two files involved, I tried to strip everything that seemed to be unimportant:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">CmakeLists.txt (Main file):<u></u><u></u></p>
<p class="MsoNormal">------------------------------------<u></u><u></u></p>
<p class="MsoNormal">include("... Helpers.cmake")<u></u><u></u></p>
<p class="MsoNormal">configureMyProject("MyProject")<u></u><u></u></p>
<p class="MsoNormal">message("Config types (outside): ${CMAKE_CONFIGURATION_TYPES}")<u></u><u></u></p>
<p class="MsoNormal">------------------------------------<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Helpers.cmake:<u></u><u></u></p>
<p class="MsoNormal">------------------------------------<u></u><u></u></p>
<p class="MsoNormal">if(__myhelpers)<u></u><u></u></p>
<p class="MsoNormal"> return()<u></u><u></u></p>
<p class="MsoNormal">endif()<u></u><u></u></p>
<p class="MsoNormal">set(__myhelpers YES)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">function(configureMyProject MY_NAME ........)<u></u><u></u></p>
<p class="MsoNormal"> set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING "" FORCE)<u></u><u></u></p>
<p class="MsoNormal"> message("Config types (before): ${CMAKE_CONFIGURATION_TYPES}")
<u></u><u></u></p>
<p class="MsoNormal"> project(${MY_NAME})
<u></u><u></u></p>
<p class="MsoNormal"> message("Config types (after): ${CMAKE_CONFIGURATION_TYPES}")
<u></u><u></u></p>
<p class="MsoNormal"> set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING "" FORCE)
<u></u><u></u></p>
<p class="MsoNormal"> message("Config types (after 2): ${CMAKE_CONFIGURATION_TYPES}")<u></u><u></u></p>
<p class="MsoNormal"> ...<u></u><u></u></p>
<p class="MsoNormal"> add_library(...)<u></u><u></u></p>
<p class="MsoNormal"> ...<u></u><u></u></p>
<p class="MsoNormal">endfunction()<u></u><u></u></p>
<p class="MsoNormal">------------------------------------<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I then get the following output:<u></u><u></u></p>
<p class="MsoNormal">------------------------------------<u></u><u></u></p>
<p class="MsoNormal">Config types (before): Debug;RelWithDebInfo<u></u><u></u></p>
<p class="MsoNormal">Config types (after): Debug;Release;MinSizeRel;RelWithDebInfo<u></u><u></u></p>
<p class="MsoNormal">Config types (after 2): Debug;RelWithDebInfo<u></u><u></u></p>
<p class="MsoNormal">Config types (outside): Debug;RelWithDebInfo<u></u><u></u></p>
<p class="MsoNormal">------------------------------------<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">So it seems to me, that the call of the project-function resetted the configuration types and created then the project accordingly.<u></u><u></u></p>
<p class="MsoNormal">Is this a bug or am I doing something wrong? Does anyone know a workaround?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Kind regards<u></u><u></u></p>
<p class="MsoNormal">Janosch Scharlipp<u></u><u></u></p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>
</div></div></div><br></div>