CTest: Potential confusion between CMAKE_BUILD_TYPE and CMAKE_CONFIG_TYPE environment variables
CMake 3.22 is adding support for a new environment variable CMAKE_BUILD_TYPE
(see !6291 (merged)). I just noticed that we already have support for a CMAKE_CONFIG_TYPE
environment variable, which is very closely related. CMAKE_CONFIG_TYPE
is only used by the CTest module, but for the same purpose as CMAKE_BUILD_TYPE
. The name CMAKE_BUILD_TYPE
is probably a better name, since it aligns to the cache variable of the same name for single config generators and is probably what developers would go looking for rather than CMAKE_CONFIG_TYPE
. But having both names, each for different scenarios, it seems like a potential point of confusion for users.
Should we update CTest to also honour CMAKE_BUILD_TYPE
as an environment variable (and give it a higher precedence than CMAKE_CONFIG_TYPE
), then deprecate CMAKE_CONFIG_TYPE
? That would be more consistent and send a clear signal about what people should use (i.e. use CMAKE_BUILD_TYPE
in all scenarios).