aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Romanko <me@blankhex.com>2024-06-16 12:23:21 +0300
committerMikhail Romanko <me@blankhex.com>2024-06-16 12:23:21 +0300
commitecab74bb2233e5f3dfc59698a6296366209ab9b1 (patch)
treea1538cc00914ccaeafee53f344fd13e96a2494fc
parentbfa33b377872d3fb7aa471e8a0af3382081971f3 (diff)
downloadbhlib-old-ecab74bb2233e5f3dfc59698a6296366209ab9b1.tar.gz
Enable additional compiler warnings
-rw-r--r--CMakeLists.txt7
-rw-r--r--tests/CMakeLists.txt10
-rw-r--r--unit/CMakeLists.txt7
3 files changed, 21 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 086f166..299eda9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,6 +127,13 @@ configure_file(include/bh/internal/config.in include/bh/internal/config.h)
add_library(bhlib STATIC ${BH_SOURCE} ${BH_HEADER})
target_include_directories(bhlib PUBLIC ${BH_INCLUDE_DIRS})
+# Enable warnings and pedantics
+if(MSVC)
+ target_compile_options(bhlib PRIVATE /W4)
+else()
+ target_compile_options(bhlib PRIVATE -Wall -Wextra -Wpedantic)
+endif()
+
# Runtime definition
add_executable(main
main.c
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e111e33..138159d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -2,9 +2,6 @@ set(CMAKE_C_STANDARD 90)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
-# Enable warnings and pedantics
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
-
# Enable testing
include(CTest)
enable_testing()
@@ -17,4 +14,11 @@ foreach(TEST_FILENAME ${TEST_FILES})
add_executable("${TEST_NAME}" ${TEST_FILENAME})
target_link_libraries("${TEST_NAME}" bhlib bhunit)
add_test(NAME "${TEST_NAME}" COMMAND "${TEST_NAME}")
+
+ # Enable warnings and pedantics
+ if(MSVC)
+ target_compile_options("${TEST_NAME}" PRIVATE /W4)
+ else()
+ target_compile_options("${TEST_NAME}" PRIVATE -Wall -Wextra -Wpedantic)
+ endif()
endforeach()
diff --git a/unit/CMakeLists.txt b/unit/CMakeLists.txt
index f1eef3e..db44dbd 100644
--- a/unit/CMakeLists.txt
+++ b/unit/CMakeLists.txt
@@ -20,3 +20,10 @@ set(BHUNIT_HEADER
# Library
add_library(bhunit STATIC ${BHUNIT_SOURCE} ${BHUNIT_HEADER})
target_include_directories(bhunit PUBLIC include)
+
+# Enable warnings and pedantics
+if(MSVC)
+ target_compile_options(bhunit PRIVATE /W4)
+else()
+ target_compile_options(bhunit PRIVATE -Wall -Wextra -Wpedantic)
+endif() \ No newline at end of file