Skip to content

Commit

Permalink
* FIX [cmake] Try to fix ci. ASAN and TSAN are not allow to enable at…
Browse files Browse the repository at this point in the history
… once.

Signed-off-by: wanghaemq <wanghamax@gmail.com>
  • Loading branch information
wanghaEMQ committed Mar 29, 2024
1 parent 3f0c647 commit 517f3d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,11 @@ if (CMAKE_BUILD_TYPE MATCHES "Debug" OR DEBUG)
message("* ASAN is enabled")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=address")
add_definitions(-DASAN)
endif (ASAN)
if (TSAN)
elseif (TSAN)
message("* TSAN is enabled")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=thread")
add_definitions(-DTSAN)
endif (TSAN)
endif (ASAN)
else()
message("-- MODE [Release] --")
endif()
10 changes: 4 additions & 6 deletions cmake/NNGHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ function(nng_link_libraries)
if (DEBUG)
if (ASAN)
target_link_libraries(nng_testing PRIVATE ${ARGN} -fsanitize=address)
endif (ASAN)
if (TSAN)
elseif (TSAN)
target_link_libraries(nng_testing PRIVATE ${ARGN} -fsanitize=thread)
endif (TSAN)
endif (ASAN)
else()
target_link_libraries(nng_testing PRIVATE ${ARGN} -fsanitize=address)
endif (DEBUG)
Expand All @@ -69,10 +68,9 @@ function(nng_link_libraries_public)
if (DEBUG)
if (ASAN)
target_link_libraries(nng_testing PRIVATE ${ARGN} -fsanitize=address)
endif (ASAN)
if (TSAN)
elseif (TSAN)
target_link_libraries(nng_testing PRIVATE ${ARGN} -fsanitize=thread)
endif (TSAN)
endif (ASAN)
else()
target_link_libraries(nng_testing PRIVATE ${ARGN} -fsanitize=address)
endif (DEBUG)
Expand Down

0 comments on commit 517f3d1

Please sign in to comment.