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

build: add the ability to build with ASAN #277

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4)
cmake_minimum_required(VERSION 3.14)

project(tjs LANGUAGES C)

Expand Down Expand Up @@ -42,6 +42,8 @@ macro(cpr_option OPTION_NAME OPTION_TEXT OPTION_DEFAULT)
message(STATUS " ${OPTION_NAME}: ${${OPTION_NAME}}")
endmacro()

cpr_option(BUILD_WITH_ASAN "If ON, build with the address sanitizer enabled" OFF)

configure_file(
${CMAKE_SOURCE_DIR}/src/js/bundle.js
${CMAKE_CURRENT_BINARY_DIR}/bundle.js
Expand Down Expand Up @@ -110,3 +112,8 @@ target_link_libraries(tjs qjs uv_a m3 m ${CURL_LIBRARIES})
if(MINGW)
target_link_libraries(tjs pthread)
endif()

if (BUILD_WITH_ASAN)
target_compile_options(tjs PRIVATE -fsanitize=address)
target_link_options(tjs PRIVATE -fsanitize=address)
endif()