Detect presence of multi-config generators

If I have multi-config generators there are some configs I would like to remove for performance reasons I read about here, what’s the best way to do this?
I.e. at what stage can I expect the GENERATOR_IS_MULTI_CONFIG to be set? Naively tried at the top of a project but even on eg MacOS it was not set then. Thanks!

It’s a property, not a variable:

get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
# use `is_multi_config`

Thanks, yes should have stated that I’ve gotten so far. I just don’t see it ever kicking in for my Xcode or VS builds, so that’s where I’m confused.
It seems like just hard-coding the CMAKE_CONFIGURATION_TYPES to the types I use has a positive impact on the configuration time, so would just like to have that soft-coded instead.

What version of CMake are you using? Note that it’s new in 3.9. That seems older than most would use, but it’s the first thing to check…

Yes sorry, it’s 3.16.3, and looks like this:

cmake_minimum_required(VERSION 3.15.4)
project(myproj)
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (is_multi_config)
	message(STATUS "is multiconfig")
else()
	message(STATUS "not multiconfig")
endif()

That’s really strange… Probably worth an issue AFAICT from that code.

Thanks - probably something stupid I do anyway. I hope to upgrade cmake quite soon so can test then again (I can’t test these locally alas).