Skip to content

Commit cc19839

Browse files
committed
build: Add option for denying incompatible types
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 7e7433c commit cc19839

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ option(FLB_SMALL "Optimise for small size" No)
156156
set(FLB_SECURITY "ReleaseOnly" CACHE STRING "Build with security optimizations")
157157
set_property(CACHE FLB_SECURITY PROPERTY STRINGS "On;Off;ReleaseOnly")
158158
option(FLB_COVERAGE "Build with code-coverage" No)
159+
option(FLB_DENY_INCOMPATIBLE_TYPES "Build with -Werror=incompatible-pointer-types" No)
159160
option(FLB_JEMALLOC "Build with Jemalloc support" No)
160161
option(FLB_REGEX "Build with Regex support" Yes)
161162
option(FLB_UTF8_ENCODER "Build with UTF8 encoding support" Yes)
@@ -436,6 +437,12 @@ if(FLB_COVERAGE)
436437
set(CMAKE_BUILD_TYPE "Debug")
437438
endif()
438439

440+
if(FLB_DENY_INCOMPABLE_TYPES)
441+
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
442+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=incompatible-pointer-types")
443+
endif()
444+
endif()
445+
439446
# Enable Debug symbols if specified
440447
if(MSVC)
441448
set(CMAKE_BUILD_TYPE None) # Avoid flag conflicts (See CMakeList.txt:L18)

0 commit comments

Comments
 (0)