diff options
author | Martin Storsjö <martin@martin.st> | 2020-11-03 16:37:00 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2020-11-04 06:38:35 +0200 |
commit | 3e13fd43df6208aca3c4d5e94a8aa9f0d255ff85 (patch) | |
tree | b0005faa9b183cd721524cf7110c2bba3fbdad91 /cmake | |
parent | 6f8df4dac0caf49a61d6a1d7d2476dc28327eb12 (diff) |
cmake: Always add -Wno-ignored-attributes for clang targeting windows
This matches how it is in the qmake mkspec, silencing a lot of
warnings - but contrary to when building with qmake, it's only
applied when building Qt itself. For external projects built with
cmake, the Qt headers are included with -isystem, which silences any
warnings from those headers.
Change-Id: I1a498d3c2715cb73e647668cb7226ceeffb7ff0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtInternalTargets.cmake | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index a04e216943..108571e759 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -6,12 +6,6 @@ function(qt_internal_set_warnings_are_errors_flags target) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "3.0.0") list(APPEND flags -Werror -Wno-error=\#warnings -Wno-error=deprecated-declarations) endif() - if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - # Clang will otherwise show error about inline method conflicting with dllimport class attribute in tools - # (this was tested with Clang 10) - # error: 'QString::operator[]' redeclared inline; 'dllimport' attribute ignored [-Werror,-Wignored-attributes] - list(APPEND flags -Wno-ignored-attributes) - endif() elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") # using AppleClang # Apple clang 4.0+ @@ -110,6 +104,13 @@ if(FEATURE_largefile AND UNIX) INTERFACE "_LARGEFILE64_SOURCE;_LARGEFILE_SOURCE") endif() +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND CMAKE_SYSTEM_NAME STREQUAL "Windows") + # Clang will otherwise show error about inline method conflicting with dllimport class attribute in tools + # (this was tested with Clang 10) + # error: 'QString::operator[]' redeclared inline; 'dllimport' attribute ignored [-Werror,-Wignored-attributes] + target_compile_options(PlatformCommonInternal INTERFACE -Wno-ignored-attributes) +endif() + # We can't use the gold linker on android with the NDK, which is the default # linker. To build our own target we will use the lld linker. # TODO: Why not? |