Skip to content

Commit

Permalink
Re-enable sanitizers.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Dec 2, 2024
1 parent 17d8dfd commit 43bc725
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ install(FILES

if(HIGHFIVE_EXAMPLES OR HIGHFIVE_UNIT_TESTS)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/HighFiveWarnings.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/HighFiveFlags.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/HighFiveOptionalDependencies.cmake)
endif()

Expand Down
30 changes: 30 additions & 0 deletions cmake/HighFiveFlags.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
if(TARGET HighFiveFlags)
# Allow multiple `include(HighFiveWarnings)`, which would
# attempt to redefine `HighFiveWarnings` and fail without
# this check.
return()
endif()

add_library(HighFiveFlags INTERFACE)

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(HIGHFIVE_MAX_ERRORS)
target_compile_options(HighFiveFlags
INTERFACE
-fmax-errors=${HIGHFIVE_MAX_ERRORS}
)
endif()
endif()

if(HIGHFIVE_GLIBCXX_ASSERTIONS)
target_compile_definitions(HighFiveFlags INTERFACE -D_GLIBCXX_ASSERTIONS)
endif()

if(HIGHFIVE_HAS_FRIEND_DECLARATIONS)
target_compile_definitions(HighFiveFlags INTERFACE -DHIGHFIVE_HAS_FRIEND_DECLARATIONS=1)
endif()

if(HIGHFIVE_SANITIZER)
target_compile_options(HighFiveFlags INTERFACE -fsanitize=${HIGHFIVE_SANITIZER})
target_link_options(HighFiveFlags INTERFACE -fsanitize=${HIGHFIVE_SANITIZER})
endif()
9 changes: 0 additions & 9 deletions cmake/HighFiveWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if(TARGET HighFiveWarnings)
endif()

add_library(HighFiveWarnings INTERFACE)
add_library(HighFiveFlags INTERFACE)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang"
OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
Expand Down Expand Up @@ -48,11 +47,3 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
endif()
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(HIGHFIVE_MAX_ERRORS)
target_compile_options(HighFiveFlags
INTERFACE
-fmax-errors=${HIGHFIVE_MAX_ERRORS}
)
endif()
endif()

0 comments on commit 43bc725

Please sign in to comment.