Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide direct CMake support for clang sanitizer #6924

Merged
merged 2 commits into from
May 3, 2024
Merged
Changes from all commits
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
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ else(NOT CHAKRACORE_BUILD_SH)
unset(LIBS_ONLY_BUILD_SH CACHE)
set(CC_LIBS_ONLY_BUILD 1)
endif()

if (CLANG_SANITIZE_SH)
set(CLANG_SANITIZE ${CLANG_SANITIZE_SH})
unset(CLANG_SANITIZE_SH CACHE)
endif()

endif(NOT CHAKRACORE_BUILD_SH)

if(CC_USES_SYSTEM_ARCH_SH OR NOT CHAKRACORE_BUILD_SH)
Expand Down Expand Up @@ -573,12 +579,11 @@ endif()
include_directories(SYSTEM /usr/local/include)
include(pal/src/configure.cmake)

# this should be after `detect feature` to not to affect feature detection
# Clang -fsanitize.
if (CLANG_SANITIZE_SH)
# Clang sanitizer support, this should be after `detect feature` to not to
# affect feature detection
if (CLANG_SANITIZE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${CLANG_SANITIZE_SH}")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsanitize=${CLANG_SANITIZE_SH}")
unset(CLANG_SANITIZE_SH CACHE) # don't cache
endif()

add_subdirectory (pal)
Expand Down
Loading