diff options
author | Brad King <brad.king@kitware.com> | 2021-11-12 14:02:23 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-11-12 14:02:41 (GMT) |
commit | 648b66a1d30c010dbf28aaad8dfc2eff56ea2c03 (patch) | |
tree | 1d9ce063bd275c2c8661dcb459989cce7345ef9a /Help/policy | |
parent | 9f6c91eb30804d573bc605e0b6cce4cf72ac164a (diff) | |
parent | e47dfce75d74de26ac6ee25625a44989312e29c1 (diff) | |
download | CMake-648b66a1d30c010dbf28aaad8dfc2eff56ea2c03.zip CMake-648b66a1d30c010dbf28aaad8dfc2eff56ea2c03.tar.gz CMake-648b66a1d30c010dbf28aaad8dfc2eff56ea2c03.tar.bz2 |
Merge topic 'cmp0128-fixup'
e47dfce75d CMP0128: Enable/disable extensions if standard same as default
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6723
Diffstat (limited to 'Help/policy')
-rw-r--r-- | Help/policy/CMP0128.rst | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/Help/policy/CMP0128.rst b/Help/policy/CMP0128.rst index b894ce1..604a146 100644 --- a/Help/policy/CMP0128.rst +++ b/Help/policy/CMP0128.rst @@ -9,8 +9,8 @@ When this policy is set to ``NEW``: :variable:`CMAKE_<LANG>_EXTENSIONS` if set, otherwise falling back to :variable:`CMAKE_<LANG>_EXTENSIONS_DEFAULT`. -* Extensions are correctly disabled/enabled if :prop_tgt:`<LANG>_STANDARD` is - unset. +* Extensions are correctly enabled/disabled if :prop_tgt:`<LANG>_STANDARD` is + unset or satisfied by the default. * Standard mode-affecting flags aren't added unless necessary to achieve the specified mode. @@ -33,26 +33,6 @@ The ``OLD`` behavior: Code may need to be updated for the ``NEW`` behavior in the following cases: -* If :prop_tgt:`<LANG>_EXTENSIONS` matches - :variable:`CMAKE_<LANG>_EXTENSIONS_DEFAULT` or is unset and the compiler's - default satisfies :prop_tgt:`<LANG>_STANDARD` but the compiled code requires - the exact standard specified. - Such code should set :prop_tgt:`<LANG>_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. @@ -64,6 +44,17 @@ Code may need to be updated for the ``NEW`` behavior in the following cases: * Or ensure the manually-specified flags are used during compiler detection. +* If extensions were disabled without :prop_tgt:`<LANG>_STANDARD` being set + CMake previously wouldn't actually disable extensions. + + Such code should be updated to not disable extensions if they are required. + +* If extensions were enabled/disabled when :prop_tgt:`<LANG>_STANDARD` was + satisfied by the compiler's default CMake previously wouldn't actually + enable/disable extensions. + + Such code should be updated to set the correct extensions mode. + If compiler flags affecting the standard mode are used during compiler detection (for example in :manual:`a toolchain file <cmake-toolchains(7)>` using :variable:`CMAKE_<LANG>_FLAGS_INIT`) then they will affect the detected |