[CMake] Check Build Type/Config Changed

Romain LEGUAY romain.leguay at gmail.com
Sun Jan 6 09:59:59 EST 2019


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 <frodak17 at gmail.com> a écrit :

>
>
> 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/20190106/6375bfd7/attachment.html>


More information about the CMake mailing list