Enable additional compiler warnings
This commit is contained in:
@@ -127,6 +127,13 @@ configure_file(include/bh/internal/config.in include/bh/internal/config.h)
|
|||||||
add_library(bhlib STATIC ${BH_SOURCE} ${BH_HEADER})
|
add_library(bhlib STATIC ${BH_SOURCE} ${BH_HEADER})
|
||||||
target_include_directories(bhlib PUBLIC ${BH_INCLUDE_DIRS})
|
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
|
# Runtime definition
|
||||||
add_executable(main
|
add_executable(main
|
||||||
main.c
|
main.c
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ set(CMAKE_C_STANDARD 90)
|
|||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_C_EXTENSIONS OFF)
|
set(CMAKE_C_EXTENSIONS OFF)
|
||||||
|
|
||||||
# Enable warnings and pedantics
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
|
|
||||||
|
|
||||||
# Enable testing
|
# Enable testing
|
||||||
include(CTest)
|
include(CTest)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
@@ -17,4 +14,11 @@ foreach(TEST_FILENAME ${TEST_FILES})
|
|||||||
add_executable("${TEST_NAME}" ${TEST_FILENAME})
|
add_executable("${TEST_NAME}" ${TEST_FILENAME})
|
||||||
target_link_libraries("${TEST_NAME}" bhlib bhunit)
|
target_link_libraries("${TEST_NAME}" bhlib bhunit)
|
||||||
add_test(NAME "${TEST_NAME}" COMMAND "${TEST_NAME}")
|
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()
|
endforeach()
|
||||||
|
|||||||
@@ -20,3 +20,10 @@ set(BHUNIT_HEADER
|
|||||||
# Library
|
# Library
|
||||||
add_library(bhunit STATIC ${BHUNIT_SOURCE} ${BHUNIT_HEADER})
|
add_library(bhunit STATIC ${BHUNIT_SOURCE} ${BHUNIT_HEADER})
|
||||||
target_include_directories(bhunit PUBLIC include)
|
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()
|
||||||
Reference in New Issue
Block a user