diff --git a/CMakeLists.txt b/CMakeLists.txt index 286e0f64..c7bc8e8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ else() endif() option(BUILD_SHARED_LIBS "Build chibi-scheme as a shared library" ${DEFAULT_SHARED_LIBS}) +option(SEXP_USE_BOEHM "Use Boehm garbage collection library" OFF) set(chibi-scheme-exclude-modules) if(WIN32) @@ -101,6 +102,18 @@ if(CYGWIN) target_compile_definitions(libchibi-common INTERFACE SEXP_USE_STRING_STREAMS=0) endif() +if(SEXP_USE_BOEHM) + find_library(BOEHMGC gc REQUIRED) + find_path(BOEHMGC_INCLUDE NAMES gc/gc.h) + target_compile_definitions(libchibi-common INTERFACE SEXP_USE_BOEHM=1) + target_include_directories(libchibi-common INTERFACE ${BOEHMGC_INCLUDE}) + target_link_libraries(libchibi-common INTERFACE ${BOEHMGC} + $<$:-fsanitize=address,undefined>) +else() + target_link_libraries(libchibi-common INTERFACE + $<$:-fsanitize=address,undefined>) +endif() + target_compile_options(libchibi-common INTERFACE $<$:-g