File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,10 @@ set(USE_UBSAN false CACHE BOOL "Set to true to enable -fsanitize=undefined when
7373if (USE_ASAN AND USE_UBSAN)
7474 message (FATAL_ERROR "USE_ASAN and USE_UBSAN must not be enabled at the same time" )
7575elseif (USE_ASAN)
76+ set (compile_flags -fsanitize=address)
7677 set (link_flags -fsanitize=address)
7778elseif (USE_UBSAN)
79+ set (compile_flags -fsanitize=undefined)
7880 set (link_flags -fsanitize=undefined)
7981endif ()
8082
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ set_property(TARGET parser_ PROPERTY CXX_STANDARD ${CXX_STD})
1414target_link_libraries (parser_ parser boost ${link_flags} )
1515if (MSVC )
1616 target_compile_options (parser_ PRIVATE /source -charset:utf-8 /bigobj)
17+ elseif (USE_ASAN OR USE_UBSAN)
18+ target_compile_options (parser_ PRIVATE ${compile_flags} )
1719endif ()
1820add_test (NAME parser_ COMMAND parser_)
1921
@@ -22,6 +24,8 @@ set_property(TARGET parser_api PROPERTY CXX_STANDARD ${CXX_STD})
2224target_link_libraries (parser_api parser boost ${link_flags} )
2325if (MSVC )
2426 target_compile_options (parser_api PRIVATE /source -charset:utf-8 /bigobj)
27+ elseif (USE_ASAN OR USE_UBSAN)
28+ target_compile_options (parser_api PRIVATE ${compile_flags} )
2529endif ()
2630add_test (NAME parser_api COMMAND parser_api)
2731
@@ -43,6 +47,8 @@ macro(add_test_executable name)
4347 target_link_libraries (${name} parser boost ${link_flags} )
4448 if (MSVC )
4549 target_compile_options (${name} PRIVATE /source -charset:utf-8 /bigobj)
50+ elseif (USE_ASAN OR USE_UBSAN)
51+ target_compile_options (${name} PRIVATE ${compile_flags} )
4652 endif ()
4753 add_test (NAME ${name} COMMAND ${name} )
4854endmacro ()
You can’t perform that action at this time.
0 commit comments