File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -179,9 +179,22 @@ set(CMAKE_CXX_FLAGS_ASAN "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -fsanitize=address -f
179179set (CMAKE_EXE_LINKER_FLAGS_ASAN "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address" )
180180set (CMAKE_SHARED_LINKER_FLAGS_ASAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address" )
181181
182+ #-----------------------------------------------------------------------------
183+ # Add UBSAN build option
184+ #-----------------------------------------------------------------------------
185+
186+ set (CMAKE_C_FLAGS_UBSAN "${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined" )
187+ set (CMAKE_CXX_FLAGS_UBSAN "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined" )
188+ set (CMAKE_EXE_LINKER_FLAGS_UBSAN "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=undefined" )
189+ set (CMAKE_SHARED_LINKER_FLAGS_UBSAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined" )
190+
191+ #-----------------------------------------------------------------------------
192+ # Add ASAN and UBSAN as explicit items in menu
193+ #-----------------------------------------------------------------------------
194+
182195get_property (_cmake_build_type_is_cache CACHE CMAKE_BUILD_TYPE PROPERTY TYPE )
183196if (_cmake_build_type_is_cache)
184- set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ASAN" )
197+ set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ASAN" "UBSAN" )
185198endif ()
186199unset (_cmake_build_type_is_cache)
187200
You can’t perform that action at this time.
0 commit comments