File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ option(FLB_SMALL "Optimise for small size" No)
158158set (FLB_SECURITY "ReleaseOnly" CACHE STRING "Build with security optimizations" )
159159set_property (CACHE FLB_SECURITY PROPERTY STRINGS "On;Off;ReleaseOnly" )
160160option (FLB_COVERAGE "Build with code-coverage" No )
161+ option (FLB_COMPILER_STRICT_POINTER_TYPES "Build with -Werror=incompatible-pointer-types" No )
161162option (FLB_JEMALLOC "Build with Jemalloc support" No )
162163option (FLB_REGEX "Build with Regex support" Yes )
163164option (FLB_UTF8_ENCODER "Build with UTF8 encoding support" Yes )
@@ -450,6 +451,17 @@ if(FLB_COVERAGE)
450451 set (CMAKE_BUILD_TYPE "Debug" )
451452endif ()
452453
454+ if (FLB_COMPILER_STRICT_POINTER_TYPES)
455+ if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
456+ add_compile_options (-Werror=incompatible-pointer-types)
457+ endif ()
458+ # Currently, AppleClang has more struct rules when using -Werror=incompatible-pointer-types.
459+ # We still permit to discarding const qualifiers warnings.
460+ if (CMAKE_C_COMPILER_ID MATCHES "AppleClang" )
461+ add_compile_options (-Wno-incompatible-pointer-types-discards-qualifiers)
462+ endif ()
463+ endif ()
464+
453465# Enable Debug symbols if specified
454466if (MSVC )
455467 set (CMAKE_BUILD_TYPE None) # Avoid flag conflicts (See CMakeList.txt:L18)
You can’t perform that action at this time.
0 commit comments