Skip to content
  • Alexandru Croitor's avatar
    CMake: Don't use std=gnu++11 when building Qt internal targets · f69dbb0b
    Alexandru Croitor authored and Jörg Bornemann's avatar Jörg Bornemann committed
    
    
    The logic is a bit involved in qmake.
    
    The Qt internal qt_common.prf adds CONFIG += strict_c++ which applies
    to qt modules, qt plugins, qml plugins, qt helper libs, winmain and
    qt_apps, qt_tools, but NOT tests (which is important because the tests
    on Windows MinGW fail to build without the GNU extensions).
    
    Then default_post.prf checks for the strict_c++ value and either uses
    the strict or non-strict C++ standard flags. default_post.prf is
    loaded for all qmake projects, not just the Qt internal ones.
    
    Now CMake doesn't provide a transitive based option to disable C++
    GNU extensions with a mechanism similar to target_compile_features.
    
    It only provides the CXX_EXTENSIONS property and it's associated
    CMAKE_CXX_EXTENSIONS variable. We can't set the variable at a
    directory scope, because that is too coarse grained.
    
    So we rely on setting the property via a function in every relevant
    qt_add_<target> function.
    
    Now the naming of the function is weird.
    We name the function as qt_internal_<...>, because it's not meant to be
    used by Qt users.
    
    We prepend an underscore to the name because we need to place it in
    Qt6CoreMacros, so that the function can be called by
    qt_add_qml_module which IS a public function.
    That's because in Qt5 load(qml_plugin) was private API, but in Qt 6 +
    CMake we decided to make qt_add_qml_module() as public API.
    
    Change-Id: Id014626b087d590e25cb46843f93d0c67fc36e44
    Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@qt.io>
    f69dbb0b