Skip to content

Commit

Permalink
Add proper warnings for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cjappl committed Dec 23, 2024
1 parent 4de22d3 commit 06868d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
cmake --version
- name: Configure CMake
run: cmake -B build -DRTLOG_USE_FMTLIB=${{ matrix.use_fmtlib }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DRTLOG_FULL_WARNINGS=ON -DRTLOG_BUILD_TESTS=ON -DRTLOG_BUILD_EXAMPLES=ON
run: cmake -B build -DRTLOG_USE_FMTLIB=${{ matrix.use_fmtlib }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DRTLOG_FULL_WARNINGS=ON -DRTLOG_BUILD_TESTS=ON -DRTLOG_BUILD_EXAMPLES=ON -j 2

- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }}
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,17 @@ target_compile_definitions(rtlog
$<$<CONFIG:Release>:NDEBUG>
)

set(RTLOG_ALL_WARNINGS)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(RTLOG_ALL_WARNINGS "-Wall;-Werror;-Wformat;-Wextra;-Wformat-security;-Wno-unused-function")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(RTLOG_ALL_WARNINGS "/W4;/WX")
endif()

target_compile_options(rtlog
INTERFACE
$<$<BOOL:${RTLOG_FULL_WARNINGS}>:-Wall -Werror -Wformat -Wextra -Wformat-security -Wno-unused-function>
$<$<BOOL:${RTLOG_FULL_WARNINGS}>:${RTLOG_ALL_WARNINGS}>
$<$<BOOL:${RTLOG_USE_RTSAN}>:-fsanitize=realtime>
)

Expand Down

0 comments on commit 06868d9

Please sign in to comment.