summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorpengxuanzheng <[email protected]>2020-11-11 11:14:02 +0800
committerpengxuanzheng <[email protected]>2020-11-11 11:14:02 +0800
commit810b099113f3fe953580e3402dbb904a442a4b9e (patch)
tree14926f869d55bf7031c83fc46bc1fb6703748a1c /example
parent6259b938ec05c538ef16e47257210f4ffa0d4e10 (diff)
添加asan检查选项
Diffstat (limited to 'example')
-rw-r--r--example/performance/CMakeLists.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/example/performance/CMakeLists.txt b/example/performance/CMakeLists.txt
index 1eea1e3a..58d2c7cf 100644
--- a/example/performance/CMakeLists.txt
+++ b/example/performance/CMakeLists.txt
@@ -8,6 +8,24 @@ link_directories(/opt/MESA/lib/)
link_libraries(hos-client-cpp pthread)
include_directories(/opt/MESA/include)
+#for ASAN
+set(ASAN_OPTION "OFF" CACHE STRING " set asan type chosen by the user, using OFF as default")
+set_property(CACHE ASAN_OPTION PROPERTY STRINGS OFF ADDRESS THREAD)
+message(STATUS "ASAN_OPTION='${ASAN_OPTION}'")
+
+if(ASAN_OPTION MATCHES "ADDRESS")
+ set(CMAKE_C_FLAGS "${CMAKADDRESS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=address -fno-omit-frame-pointer")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=address -fno-omit-frame-pointer")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
+elseif(ASAN_OPTION MATCHES "THREAD")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=thread -fno-omit-frame-pointer")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=thread -fno-omit-frame-pointer")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
+endif()
+# end of for ASAN
+
add_executable(HosClientPerformance HosClientPerformance.cpp)
target_link_libraries(HosClientPerformance hos-client-cpp)