On Sun, Jan 6, 2019 at 10:00 AM Romain LEGUAY <romain.leg...@gmail.com> wrote:
> 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. > > Either of them can be set at the command line using -D or preloaded into the cache. Then either of them can be set by whatever CMakeLists.txt is doing. For example I've seen some projects set CMAKE_BUILD_TYPE to RELEASE if it wasn't already set by the user. 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. 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. CMAKE_CONFIGURATION_TYPES isn't really safe to check until after the project() command. But CMAKE_CONFIGURATION_TYPES is just a list of all possible build types is does not contain the last chosen build. You mentioned that you were using Visual Studio 2017 as the generator. Then you should know since it's a multi config generator CMAKE_BUILD_TYPE is ignored and has no bearing on the build type. 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. Also a user could even change the build type per target if they don't just do a build all.
-- 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