Skip to content

Commit

Permalink
ros2GH-17 Allow disabling the usage of sanitizers
Browse files Browse the repository at this point in the history
This allows manual usage of valgrind.
  • Loading branch information
anhosi committed Nov 26, 2018
1 parent 550d81e commit e479b2b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rosbag2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

option(DISABLE_SANITIZERS "disables the use of gcc saniztizers")

find_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(pluginlib REQUIRED)
Expand Down Expand Up @@ -126,8 +128,10 @@ if(BUILD_TESTING)
src/rosbag2/types/ros2_message.cpp)
if(TARGET test_ros2_message)
target_compile_definitions(test_ros2_message PRIVATE "ROSBAG2_BUILDING_DLL")
target_compile_options(test_ros2_message PUBLIC $<$<CXX_COMPILER_ID:GNU>:-fsanitize=leak>)
target_link_libraries(test_ros2_message $<$<CXX_COMPILER_ID:GNU>:-fsanitize=leak>)
if(NOT DISABLE_SANITIZERS)
target_compile_options(test_ros2_message PUBLIC $<$<CXX_COMPILER_ID:GNU>:-fsanitize=leak>)
target_link_libraries(test_ros2_message $<$<CXX_COMPILER_ID:GNU>:-fsanitize=leak>)
endif()
target_include_directories(test_ros2_message
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down

0 comments on commit e479b2b

Please sign in to comment.