CMP0128 ------- .. versionadded:: 3.22 When this policy is set to ``NEW``: * :prop_tgt:`_EXTENSIONS` is initialized to :variable:`CMAKE__EXTENSIONS_DEFAULT`. * Extensions are correctly disabled/enabled if :prop_tgt:`_STANDARD` is unset. * Standard mode-affecting flags aren't added unless necessary to achieve the specified mode. The ``OLD`` behavior: * Initializes :prop_tgt:`_EXTENSIONS` to ``ON``. * Always adds a flag if :prop_tgt:`_STANDARD` is set and :prop_tgt:`_STANDARD_REQUIRED` is ``OFF``. * If :prop_tgt:`_STANDARD` is unset: * Doesn't disable extensions even if :prop_tgt:`_EXTENSIONS` is ``OFF``. * Fails to enable extensions if :prop_tgt:`_EXTENSIONS` is ``ON`` except for the ``IAR`` compiler. Code may need to be updated for the ``NEW`` behavior in the following cases: * If :prop_tgt:`_EXTENSIONS` matches :variable:`CMAKE__EXTENSIONS_DEFAULT` or is unset and the compiler's default satisfies :prop_tgt:`_STANDARD` but the compiled code requires the exact standard specified. Such code should set :prop_tgt:`_STANDARD_REQUIRED` to ``ON``. For example: .. code-block:: cmake cmake_minimum_required(VERSION |release|) project(example C) add_executable(exe main.c) set_property(TARGET exe PROPERTY C_STANDARD 99) If the compiler defaults to C11 then the standard specification for C99 is satisfied and CMake will pass no flags. ``main.c`` will no longer compile if it is incompatible with C11. * If a standard mode flag previously overridden by CMake's and not used during compiler detection now takes effect due to CMake no longer adding one as the default detected is appropriate. Such code should be converted to either: * Use :prop_tgt:`_STANDARD` and :prop_tgt:`_EXTENSIONS` instead of manually adding flags. * Or ensure the manually-specified flags are used during compiler detection. If compiler flags affecting the standard mode are used during compiler detection (for example in :manual:`a toolchain file ` using :variable:`CMAKE__FLAGS_INIT`) then they will affect the detected default :variable:`standard _STANDARD_DEFAULT>` and :variable:`extensions _EXTENSIONS_DEFAULT>`. Unlike many policies, CMake version |release| does *not* warn when the policy is not set and simply uses the ``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. See documentation of the :variable:`CMAKE_POLICY_WARNING_CMP0128 >` variable to control the warning. .. include:: DEPRECATED.txt