Skip to content

Commit 4cc3c98

Browse files
committed
fix(ci): suppress sign-conversion warnings in AppleClang
Move the -Wno-sign-conversion flag from CI workflow to CMake where it can be properly applied to all targets. - Detect AppleClang specifically in CompilerOptions.cmake - Add -Wno-sign-conversion for AppleClang to suppress warnings from third-party libraries like RapidCheck - Revert CI workflow change (no longer needed)
1 parent 64e4a90 commit 4cc3c98

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
cmake -B build \
8585
-G Ninja \
8686
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
87-
-DCMAKE_CXX_FLAGS="${{ matrix.os == 'macos-latest' && '-march=native -Wno-sign-conversion' || '-march=native' }}"
87+
-DCMAKE_CXX_FLAGS="-march=native"
8888
8989
- name: Build
9090
run: cmake --build build --config ${{ env.BUILD_TYPE }}

cmake/CompilerOptions.cmake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ set(HPC_IS_GCC FALSE)
99
set(HPC_IS_CLANG FALSE)
1010
set(HPC_IS_MSVC FALSE)
1111
set(HPC_IS_ARM FALSE)
12+
set(HPC_IS_APPLE_CLANG FALSE)
1213

1314
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
1415
set(HPC_IS_GCC TRUE)
1516
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1617
set(HPC_IS_CLANG TRUE)
18+
# Detect Apple Clang (has different warning behavior)
19+
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
20+
set(HPC_IS_APPLE_CLANG TRUE)
21+
endif()
1722
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
1823
set(HPC_IS_MSVC TRUE)
1924
endif()
@@ -30,7 +35,7 @@ endif()
3035
function(hpc_set_compiler_options target)
3136
# Parse arguments
3237
cmake_parse_arguments(ARG "DISABLE_WARNINGS;ENABLE_FAST_MATH" "" "" ${ARGN})
33-
38+
3439
# Warning flags
3540
if(NOT ARG_DISABLE_WARNINGS)
3641
if(HPC_IS_GCC OR HPC_IS_CLANG)
@@ -47,6 +52,13 @@ function(hpc_set_compiler_options target)
4752
-Woverloaded-virtual
4853
-Wformat=2
4954
)
55+
# Apple Clang has stricter sign-conversion warnings that trigger
56+
# in third-party libraries like RapidCheck. Suppress them.
57+
if(HPC_IS_APPLE_CLANG)
58+
target_compile_options(${target} PRIVATE
59+
-Wno-sign-conversion
60+
)
61+
endif()
5062
elseif(HPC_IS_MSVC)
5163
target_compile_options(${target} PRIVATE
5264
/W4

0 commit comments

Comments
 (0)