<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 2, 2017 at 11:50 AM, David Cole via CMake <span dir="ltr"><<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Yes, your code is a good example Marcus. It was one of the previous<br>
suggestions on this thread which had example code setting<br>
CMAKE_CONFIGURATION_TYPES.<br>
<br>
I would recommend against setting this variable because in some places<br>
in CMake code, it is used as an approximate proxy for whether or not a<br>
multi-configuration generator is being used.<br>
<br>
<br>
For a few examples, see the CMake code base itself:<br>
<br></blockquote><div>MinGW Makefiles supports multiple configurations; one at a time.  And reading a few of these...</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
$ git grep CMAKE_CONFIGURATION_TYPES | grep -Ev<br>
"Auxiliary/vim/syntax/cmake.<wbr>vim|Help/|Tests/"</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
CMakeCPack.cmake:  if(CMAKE_CONFIGURATION_TYPES)<br></blockquote><div>this one is not distributed, and I don't have it.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Modules/<wbr>CMakeExpandImportedTargets.<wbr>cmake:#<br>
${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}.<br>
Modules/<wbr>CMakeExpandImportedTargets.<wbr>cmake:      if(CMAKE_CONFIGURATION_TYPES)<br>
Modules/<wbr>CMakeExpandImportedTargets.<wbr>cmake:         list(GET<br>
CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION)<br></blockquote><div><br></div><div>the whole point is to get a good setting list for CMAKE_BUILD TYPE so this is harmless because built type will override the default behavior...</div><div><div># CONFIGURATION is given, it uses the first configuration from</div><div># ${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}.</div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Modules/CTestTargets.cmake:if(<wbr>CMAKE_CONFIGURATION_TYPES)<br></blockquote><div><br></div><div>I would want this to pass CONFIGURATION_TYPES to included external projects because it's missing otherwise anyway.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Modules/DeployQt4.cmake:                        if(configurations AND<br>
(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE))<br>
Modules/DeployQt4.cmake:                if(CMAKE_CONFIGURATION_TYPES<br>
OR CMAKE_BUILD_TYPE)<br></blockquote><div><br></div><div>This is used to use the argument passed to the macro if CMAKE_BUILD_TYPE (this is what we want set anyway) OR CMAKE_CONFIGUATION_TYPES is set.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Modules/ExternalProject.cmake:      if(CMAKE_CONFIGURATION_TYPES)<br>
Modules/ExternalProject.cmake:        if(CMAKE_CONFIGURATION_TYPES)<br>
Modules/ExternalProject.cmake:  if(CMAKE_CONFIGURATION_TYPES)<br>
Modules/ExternalProject.cmake:    if(CMAKE_CONFIGURATION_TYPES)<br>
Modules/ExternalProject.cmake:      foreach(cfg ${CMAKE_CONFIGURATION_TYPES})<br></blockquote><div><br></div><div>In these cases, it makes sure to pass the build configuration passed from the core project, otherwise it leaves it blank.  Since I want to specify the build configuration anyway, this should always be set if externalproject is  used.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Modules/FindBoost.cmake:      if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)<br></blockquote><div><br></div><div>if neither of these are set it sets release output.  and we're trying to make sure that CMAKE_BUILD_TYPE is set to something not blank anyway.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Modules/FindCUDA.cmake:# Makefile and similar generators don't define<br>
CMAKE_CONFIGURATION_TYPES, so we<br>
Modules/FindCUDA.cmake:set(<wbr>CUDA_configuration_types<br>
${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel<br>
Release RelWithDebInfo)<br></blockquote><div><br></div><div>This one includes already set configuration types, and add capitalized versions; then builds a list and removes duplicate because it sets all configurations to UPPER(); so this is harmless.  and is a better implementation than the below SelectLibraryConfigurations.<wbr>cmake:   </div><div><br></div><div>(comment block in FindCUDA)</div><div><div># Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we</div><div># need to add another entry for the CMAKE_BUILD_TYPE.  We also need to add the</div><div># standerd set of 4 build types (Debug, MinSizeRel, Release, and RelWithDebInfo)</div><div># for completeness.  We need run this loop in order to accomodate the addition</div><div># of extra configuration types.  Duplicate entries will be removed by</div><div># REMOVE_DUPLICATES.</div></div><div><br></div><div>...and yet they[makefile and similar] should have configuration types; because they can build all of those configurations.<br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Modules/FindQt4.cmake:        if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)<br></blockquote><div><br></div><div><br></div><div>again- cmake_build_type is being set, so don't default to Release</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Modules/<wbr>SelectLibraryConfigurations.<wbr>cmake:           (<br>
CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) )<br></blockquote><div><br></div><div>Would be triggered because we're setting CMAKE_BUILD_TYPE anyway..; and also does not support minreldebinfo or MinSizeRel; and instead only checks _DEBUG and _RELEASE targets.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Source/<wbr>cmGlobalVisualStudio7Generator<wbr>.cxx:  if<br>
(!mf->GetDefinition("CMAKE_<wbr>CONFIGURATION_TYPES")) {<br>
Source/<wbr>cmGlobalVisualStudio7Generator<wbr>.cxx:<br>
"CMAKE_CONFIGURATION_TYPES",<br>
"Debug;Release;MinSizeRel;<wbr>RelWithDebInfo",</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Source/cmGlobalXCodeGenerator.<wbr>cxx:  if<br>
(!mf->GetDefinition("CMAKE_<wbr>CONFIGURATION_TYPES")) {<br>
Source/cmGlobalXCodeGenerator.<wbr>cxx:      "CMAKE_CONFIGURATION_TYPES",<br>
"Debug;Release;MinSizeRel;<wbr>RelWithDebInfo",<br>
Source/cmGlobalXCodeGenerator.<wbr>cxx:<br>
this->CurrentMakefile-><wbr>GetRequiredDefinition("CMAKE_<wbr>CONFIGURATION_TYPES");<br>
Source/cmMakefile.cxx:<br>
this->GetDefinition("CMAKE_<wbr>CONFIGURATION_TYPES")) {<br>
Utilities/Release/WiX/<wbr>CMakeLists.txt:if(CMAKE_<wbr>CONFIGURATION_TYPES)<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><div></div></div></div></blockquote><div><br></div><div>These would be used, and would set cmake_configuration_types so we don't have to; they set it, not use it.<br></div><div><br></div><div><br></div><div>So, all in all, it looks like it is either indifferent to being set, or SHOULD be set to make sure configuration types are propagate (externalProject).  </div><div><br></div><div><br></div><div>I asked a LONG time ago why this wasn't set by default anyway, and was told 'because makefiles'... and yet I built all sortf of projects using makefile generators and found that I HAD to get this set anyway because I was building Debug and Release modes continuously there (one so I could debug, the other so I could test optimal); otherwise the output behavior was inconsistent and would overlap release and debug configuration builds.  I subsequently fixed THAT by making sure to build in .../build/debug_projects and output to ../build/debug_out (install target) and ..../build/release_projects and .../build/release_out so iteritive building wouldn't get mixed debug and release objects trying to build into a library/executable.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><div><br></div><div><br></div>
<br>
<br>
<br>
On Wed, Aug 2, 2017 at 2:42 PM, Marcus D. Hanwell<br>
<<a href="mailto:marcus.hanwell@kitware.com">marcus.hanwell@kitware.com</a>> wrote:<br>
> On Wed, Aug 2, 2017 at 1:32 PM, David Cole <<a href="mailto:DLRdave@aol.com">DLRdave@aol.com</a>> wrote:<br>
>> Very cool, Marcus. Thanks for the blog post.<br>
>><br>
>> Florian, when you "message(${CMAKE_<wbr>CONFIGURATION_TYPES})" it is empty<br>
>> because you are using a single-configuration CMake generator. Only<br>
>> Visual Studio and Xcode (and possibly other) **multi** config<br>
>> generators have a list of values in CMAKE_CONFIGURATION_TYPES.<br>
>> Contrary to the previous recommendation, I would NOT recommend setting<br>
>> it to a list in a single configuration generator. If you're using a<br>
>> multi-config generator, you can set up a subset for it to use with<br>
>> this, but in a single config generator, this variable SHOULD be empty,<br>
>> and you should not give it contents in that case.<br>
>><br>
> Terrible English, try number two... Why would you not recommend<br>
> setting it, and what do you mean by it? I was not setting<br>
> CMAKE_CONFIGURATION_TYPES to anything, but the CMAKE_BUILD_TYPE<br>
> property is manipulated to offer the list, and then the<br>
> CMAKE_BUILD_TYPE variable is populated if it is empty in my example.<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div></div>