Yes, your code is a good example Marcus. It was one of the previous suggestions on this thread which had example code setting CMAKE_CONFIGURATION_TYPES.
I would recommend against setting this variable because in some places in CMake code, it is used as an approximate proxy for whether or not a multi-configuration generator is being used. For a few examples, see the CMake code base itself: $ git grep CMAKE_CONFIGURATION_TYPES | grep -Ev "Auxiliary/vim/syntax/cmake.vim|Help/|Tests/" CMakeCPack.cmake: if(CMAKE_CONFIGURATION_TYPES) Modules/CMakeExpandImportedTargets.cmake:# ${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}. Modules/CMakeExpandImportedTargets.cmake: if(CMAKE_CONFIGURATION_TYPES) Modules/CMakeExpandImportedTargets.cmake: list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION) Modules/CTestTargets.cmake:if(CMAKE_CONFIGURATION_TYPES) Modules/DeployQt4.cmake: if(configurations AND (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)) Modules/DeployQt4.cmake: if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) Modules/ExternalProject.cmake: if(CMAKE_CONFIGURATION_TYPES) Modules/ExternalProject.cmake: if(CMAKE_CONFIGURATION_TYPES) Modules/ExternalProject.cmake: if(CMAKE_CONFIGURATION_TYPES) Modules/ExternalProject.cmake: if(CMAKE_CONFIGURATION_TYPES) Modules/ExternalProject.cmake: foreach(cfg ${CMAKE_CONFIGURATION_TYPES}) Modules/FindBoost.cmake: if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) Modules/FindCUDA.cmake:# Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we Modules/FindCUDA.cmake:set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo) Modules/FindQt4.cmake: if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) Modules/SelectLibraryConfigurations.cmake: ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) ) Source/cmGlobalVisualStudio7Generator.cxx: if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { Source/cmGlobalVisualStudio7Generator.cxx: "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo", Source/cmGlobalXCodeGenerator.cxx: if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { Source/cmGlobalXCodeGenerator.cxx: "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo", Source/cmGlobalXCodeGenerator.cxx: this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES"); Source/cmMakefile.cxx: this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { Utilities/Release/WiX/CMakeLists.txt:if(CMAKE_CONFIGURATION_TYPES) On Wed, Aug 2, 2017 at 2:42 PM, Marcus D. Hanwell <marcus.hanw...@kitware.com> wrote: > On Wed, Aug 2, 2017 at 1:32 PM, David Cole <dlrd...@aol.com> wrote: >> Very cool, Marcus. Thanks for the blog post. >> >> Florian, when you "message(${CMAKE_CONFIGURATION_TYPES})" it is empty >> because you are using a single-configuration CMake generator. Only >> Visual Studio and Xcode (and possibly other) **multi** config >> generators have a list of values in CMAKE_CONFIGURATION_TYPES. >> Contrary to the previous recommendation, I would NOT recommend setting >> it to a list in a single configuration generator. If you're using a >> multi-config generator, you can set up a subset for it to use with >> this, but in a single config generator, this variable SHOULD be empty, >> and you should not give it contents in that case. >> > Terrible English, try number two... Why would you not recommend > setting it, and what do you mean by it? I was not setting > CMAKE_CONFIGURATION_TYPES to anything, but the CMAKE_BUILD_TYPE > property is manipulated to offer the list, and then the > CMAKE_BUILD_TYPE variable is populated if it is empty in my example. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake