From: Casey Bodley Date: Sun, 5 Mar 2023 02:09:20 +0000 (-0500) Subject: cmake/boost: WITH_ASAN adds BOOST_USE_ASAN to context X-Git-Tag: v19.0.0~1565^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F50385%2Fhead;p=ceph.git cmake/boost: WITH_ASAN adds BOOST_USE_ASAN to context also adds 'context-impl=ucontext' to the b2 command line and the BOOST_USE_UCONTEXT define as described in: https://www.boost.org/doc/libs/1_79_0/libs/context/doc/html/context/stack/sanitizers.html Signed-off-by: Casey Bodley --- diff --git a/cmake/modules/BuildBoost.cmake b/cmake/modules/BuildBoost.cmake index 8db3de959634..8cccecd144bc 100644 --- a/cmake/modules/BuildBoost.cmake +++ b/cmake/modules/BuildBoost.cmake @@ -136,6 +136,9 @@ function(do_build_boost root_dir version) if(WITH_BOOST_VALGRIND) list(APPEND b2 valgrind=on) endif() + if(WITH_ASAN) + list(APPEND b2 context-impl=ucontext) + endif() set(build_command ${b2} headers stage #"--buildid=ceph" # changes lib names--can omit for static @@ -232,6 +235,10 @@ macro(build_boost version) set_target_properties(Boost::${c} PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_USE_VALGRIND") endif() + if((c MATCHES "context") AND (WITH_ASAN)) + set_target_properties(Boost::${c} PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_USE_ASAN;BOOST_USE_UCONTEXT") + endif() list(APPEND Boost_LIBRARIES ${Boost_${upper_c}_LIBRARY}) endforeach() foreach(c ${Boost_BUILD_COMPONENTS})