[CMake] Check Build Type/Config Changed

frodak17 frodak17 at gmail.com
Sat Jan 5 11:34:52 EST 2019


On Sat, Jan 5, 2019 at 11:08 AM Romain LEGUAY <romain.leguay at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190105/5d5d047b/attachment.html>


More information about the CMake mailing list