Skip to content

Commit 6e83d67

Browse files
committed
Enable more warnings treated as errors
1 parent 6a06c5a commit 6e83d67

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ cmake_minimum_required(VERSION 3.15)
66
# Enable CMAKE_MSVC_RUNTIME_LIBRARY on Windows: https://cmake.org/cmake/help/latest/policy/CMP0091.html
77
cmake_policy(SET CMP0091 NEW)
88

9+
# Do not set default MSVC warning flags: https://cmake.org/cmake/help/latest/policy/CMP0092.html
10+
cmake_policy(SET CMP0092 NEW)
11+
912
# Default to the last updated version from version.txt.
1013
file(TO_CMAKE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.txt" VERSION_FILE)
1114
file(READ "${VERSION_FILE}" LATEST_VERSION)
@@ -52,6 +55,13 @@ if(VCPKG_TARGET_TRIPLET)
5255
endif()
5356
endif()
5457

58+
# Enable more warnings, and treat warnings as errors.
59+
if(MSVC)
60+
add_compile_options(/W4 /WX /permissive-)
61+
else()
62+
add_compile_options(-Wall -Wextra -pedantic -Werror)
63+
endif()
64+
5565
function(add_bigobj_flag target)
5666
if(MSVC)
5767
# MSVC requires the /bigobj flag if the number of sections gets too big.

0 commit comments

Comments
 (0)