Skip to content

Commit 79c4893

Browse files
committed
🐛 Correctly link asan
1 parent 41f1786 commit 79c4893

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ target_include_directories(asyncpp_grpc
3636
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
3737
target_compile_features(asyncpp_grpc PUBLIC cxx_std_20)
3838

39+
if(ASYNCPP_WITH_ASAN)
40+
message(STATUS "Building with asan enabled")
41+
target_compile_options(asyncpp_grpc PRIVATE -fsanitize=address)
42+
target_link_libraries(asyncpp_grpc PRIVATE -fsanitize=address)
43+
endif()
44+
3945
if(ASYNCPP_BUILD_TEST)
4046
enable_testing()
4147
include(GoogleTest)
@@ -61,9 +67,8 @@ if(ASYNCPP_BUILD_TEST)
6167
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/protos/)
6268

6369
if(ASYNCPP_WITH_ASAN)
64-
message(STATUS "Building with asan enabled")
6570
target_compile_options(asyncpp_grpc-test PRIVATE -fsanitize=address)
66-
target_link_libraries(asyncpp_grpc-test PRIVATE asan)
71+
target_link_libraries(asyncpp_grpc-test PRIVATE -fsanitize=address)
6772
endif()
6873

6974
gtest_discover_tests(asyncpp_grpc-test)

0 commit comments

Comments
 (0)