Thank you for your answer! What I found strange is that CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE are empty at the begining of the cmake script.
When do those variables instanciated? 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. Le sam. 5 janv. 2019 à 17:35, frodak17 <froda...@gmail.com> a écrit : > > > On Sat, Jan 5, 2019 at 11:08 AM Romain LEGUAY <romain.leg...@gmail.com> > wrote: > >> Hi everyone, >> >> >> >> Is there a way to test if the build type changed? >> >> >> I try to create a cache variable with CMAKE_BUILD_TYPE as value but I >> found an unexpected result: CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES >> are not defined (I'm working on Windows with Visual Studio 2017, Visual >> Studio Code and Qt Creator). >> >> >> Thank you, >> >> >> > CMAKE_CONFIGURATION_TYPES is used by multi-config generators and > CMAKE_BUILD_TYPE isn't used. > CMAKE_CONFIGURATION_TYPES should default to > "Debug;Release;MinSizeRel;RelWithDebInfo" for Visual Studio generators > unless it was explicitly set to something else. > > If you aren't using a multi-config generator then CMAKE_BUILD_TYPE will be > empty unless it was set by the user or the CMakeLists.txt sets a default > value if empty. > > When building with Visual Studio the build type probably could be written > to a file using a post-build rule or something like that. >
-- 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: https://cmake.org/mailman/listinfo/cmake