Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable warnings as errors for clang-cl builds #2114

Merged
merged 2 commits into from Jun 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Expand Up @@ -13,6 +13,7 @@ jobs:
platform:
- { name: Windows VS2019, os: windows-2019 }
- { name: Windows VS2022, os: windows-2022 }
- { name: Windows VS2022 Clang, os: windows-2022, flags: -T ClangCL }
- { name: Linux GCC, os: ubuntu-latest }
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
- { name: MacOS XCode, os: macos-latest }
Expand Down
8 changes: 7 additions & 1 deletion cmake/CompilerWarnings.cmake
Expand Up @@ -68,7 +68,13 @@ function(set_file_warnings)
# -Wimplicit-fallthrough # warn when a missing break causes control flow to continue at the next case in a switch statement (disabled until better compiler support for explicit fallthrough is available)
${NON_ANDROID_CLANG_AND_GCC_WARNINGS}
)


# For now if we're using MSVC-like clang interface on Windows
# we'll disable warnings as errors
if(SFML_OS_WINDOWS AND SFML_COMPILER_CLANG_CL)
set(WARNINGS_AS_ERRORS FALSE)
endif()

if(WARNINGS_AS_ERRORS)
set(CLANG_AND_GCC_WARNINGS ${CLANG_AND_GCC_WARNINGS} -Werror)
set(MSVC_WARNINGS ${MSVC_WARNINGS} /WX)
Expand Down
5 changes: 5 additions & 0 deletions cmake/Config.cmake
Expand Up @@ -107,6 +107,11 @@ if(MSVC)
elseif(MSVC_VERSION LESS_EQUAL 1939)
set(SFML_MSVC_VERSION 17)
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(SFML_COMPILER_CLANG_CL 1)
endif()

elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(SFML_COMPILER_CLANG 1)

Expand Down