Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
build: Implement strict pointer types option
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
  • Loading branch information
cosmo0920 committed Oct 21, 2025
commit 70f79793d82bf1537aa12367804d5c080ef42d7d
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ option(FLB_SMALL "Optimise for small size" No)
set(FLB_SECURITY "ReleaseOnly" CACHE STRING "Build with security optimizations")
set_property(CACHE FLB_SECURITY PROPERTY STRINGS "On;Off;ReleaseOnly")
option(FLB_COVERAGE "Build with code-coverage" No)
option(FLB_COMPILER_STRICT_POINTER_TYPES "Build with -Werror=incompatible-pointer-types" No)
option(FLB_JEMALLOC "Build with Jemalloc support" No)
option(FLB_REGEX "Build with Regex support" Yes)
option(FLB_UTF8_ENCODER "Build with UTF8 encoding support" Yes)
Expand Down Expand Up @@ -450,6 +451,17 @@ if(FLB_COVERAGE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

if(FLB_COMPILER_STRICT_POINTER_TYPES)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
add_compile_options(-Werror=incompatible-pointer-types)
endif()
# Currently, AppleClang has more struct rules when using -Werror=incompatible-pointer-types.
# We still permit to discarding const qualifiers warnings.
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
add_compile_options(-Wno-incompatible-pointer-types-discards-qualifiers)
endif()
endif()

# Enable Debug symbols if specified
if(MSVC)
set(CMAKE_BUILD_TYPE None) # Avoid flag conflicts (See CMakeList.txt:L18)
Expand Down