<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Jan 6, 2019 at 10:00 AM Romain LEGUAY <<a href="mailto:romain.leguay@gmail.com">romain.leguay@gmail.com</a>> wrote:<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 dir="ltr">Thank you for your answer!<div><br></div><div>What I found strange is that CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE are empty at the begining of the cmake script. </div><div><br></div><div>When do those variables instanciated?</div><div><br></div><div>The purpose to know if the build type changed is to reactivate a superbuild variable to build my external dependencies in the good build type.</div></div><br></blockquote><div><br></div><div>Either of them can be set at the command line using -D or preloaded into the cache.</div><div><br></div><div>Then either of them can be set by whatever CMakeLists.txt is doing.</div><div>For example I've seen some projects set 
CMAKE_BUILD_TYPE to RELEASE if it wasn't already set by the user.</div><div><br></div><div>Then for Visual Studio generator it will set 
CMAKE_CONFIGURATION_TYPES if it wasn't already set by something else when it processes the project() command.</div><div><br></div><div>So for Makefile generators 
CMAKE_BUILD_TYPE it might never be set.  This indicates its a generic build and not one of DEBUG/RELEASE/etc which adds extra flags to the generic build.</div><div><br></div><div>
CMAKE_CONFIGURATION_TYPES isn't really safe to check until after the project() command.</div><div>But 
CMAKE_CONFIGURATION_TYPES is just a list of all possible build types is does not contain the last chosen build.</div><div><br></div>You mentioned that you were using Visual Studio 2017 as the generator.</div><div class="gmail_quote">Then you should know since it's a multi config generator 
CMAKE_BUILD_TYPE is ignored and has no bearing on the build type.</div><div class="gmail_quote">This is because the build type isn't known at configuration time but at build time when the user selects the build type from the GUI.</div><div class="gmail_quote">Also a user could even change the build type per target if they don't just do a build all.<br></div><div class="gmail_quote"><div><br></div></div></div>