cmake: Allow CMAKE_CONFIGURATION_TYPES to be set by environment variable

When no `CMAKE_CONFIGURATION_TYPES` is explicitly specified while
creating a new build tree, check for an environment variable of the same
name.

Issue: #20983
This commit is contained in:
Brad King
2021-06-29 16:58:16 -04:00
parent e216b9bbd3
commit ef56eefc9b
10 changed files with 40 additions and 2 deletions

View File

@@ -10,7 +10,9 @@ types.
This variable is initialized by the first :command:`project` or
:command:`enable_language` command called in a project when a new build
tree is first created. The default value is generator-specific.
tree is first created. If the :envvar:`CMAKE_CONFIGURATION_TYPES`
environment variable is set, its value is used. Otherwise, the default
value is generator-specific.
See :variable:`CMAKE_BUILD_TYPE` for specifying the configuration with
single-config generators.