Skip to content

Commit f841159

Browse files
committed
Propagate sanitizer link flags to consumers
1 parent 022f44e commit f841159

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ target_include_directories(microtimer
2323
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
2424
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
2525

26+
string(REGEX MATCHALL "-fsanitize=[^ ]+" MICROTIMER_SANITIZER_FLAGS "${CMAKE_C_FLAGS}")
27+
if(MICROTIMER_SANITIZER_FLAGS)
28+
target_link_options(microtimer INTERFACE ${MICROTIMER_SANITIZER_FLAGS})
29+
endif()
30+
2631
set_target_properties(microtimer PROPERTIES
2732
EXPORT_NAME microtimer
2833
VERSION ${PROJECT_VERSION}

0 commit comments

Comments
 (0)