mirror of
https://github.com/boostorg/parser.git
synced 2026-01-19 04:22:13 +00:00
Fix ignored USE_{A,UB}SAN in CMake files.
This commit is contained in:
@@ -73,8 +73,10 @@ set(USE_UBSAN false CACHE BOOL "Set to true to enable -fsanitize=undefined when
|
||||
if (USE_ASAN AND USE_UBSAN)
|
||||
message(FATAL_ERROR "USE_ASAN and USE_UBSAN must not be enabled at the same time")
|
||||
elseif (USE_ASAN)
|
||||
set(compile_flags -fsanitize=address)
|
||||
set(link_flags -fsanitize=address)
|
||||
elseif (USE_UBSAN)
|
||||
set(compile_flags -fsanitize=undefined)
|
||||
set(link_flags -fsanitize=undefined)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ set_property(TARGET parser_ PROPERTY CXX_STANDARD ${CXX_STD})
|
||||
target_link_libraries(parser_ parser boost ${link_flags})
|
||||
if (MSVC)
|
||||
target_compile_options(parser_ PRIVATE /source-charset:utf-8 /bigobj)
|
||||
elseif (USE_ASAN OR USE_UBSAN)
|
||||
target_compile_options(parser_ PRIVATE ${compile_flags})
|
||||
endif ()
|
||||
add_test(NAME parser_ COMMAND parser_)
|
||||
|
||||
@@ -22,6 +24,8 @@ set_property(TARGET parser_api PROPERTY CXX_STANDARD ${CXX_STD})
|
||||
target_link_libraries(parser_api parser boost ${link_flags})
|
||||
if (MSVC)
|
||||
target_compile_options(parser_api PRIVATE /source-charset:utf-8 /bigobj)
|
||||
elseif (USE_ASAN OR USE_UBSAN)
|
||||
target_compile_options(parser_api PRIVATE ${compile_flags})
|
||||
endif ()
|
||||
add_test(NAME parser_api COMMAND parser_api)
|
||||
|
||||
@@ -43,6 +47,8 @@ macro(add_test_executable name)
|
||||
target_link_libraries(${name} parser boost ${link_flags})
|
||||
if (MSVC)
|
||||
target_compile_options(${name} PRIVATE /source-charset:utf-8 /bigobj)
|
||||
elseif (USE_ASAN OR USE_UBSAN)
|
||||
target_compile_options(${name} PRIVATE ${compile_flags})
|
||||
endif ()
|
||||
add_test(NAME ${name} COMMAND ${name})
|
||||
endmacro()
|
||||
|
||||
Reference in New Issue
Block a user