+if (${CMAKE_BUILD_TYPE_LC} MATCHES "release")
+ add_compile_options(-O3 -fstack-protector -fno-common)
+ add_compile_definitions(_FORTIFY_SOURCE=2)
+elseif (${CMAKE_BUILD_TYPE_LC} MATCHES "debug")
+ add_compile_options(-O0 -fstack-protector -fno-common)
+ add_compile_definitions(CLIB_DEBUG)
+elseif (${CMAKE_BUILD_TYPE_LC} MATCHES "coverity")
+ add_compile_options(-O0)
+ add_compile_definitions(__COVERITY__)
+elseif (${CMAKE_BUILD_TYPE_LC} MATCHES "gcov")
+ add_compile_options(-O0 -fprofile-arcs -ftest-coverage)
+ add_compile_definitions(CLIB_DEBUG CLIB_GCOV)
+endif()
+
+set(BUILD_TYPES release debug coverity gcov)
+string(REPLACE ";" " " BUILD_TYPES_STR "${BUILD_TYPES}")
+set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
+ HELPSTRING "Build type - valid options are: ${BUILD_TYPES_STR}")
+
+##############################################################################
+# link time optimizations
+##############################################################################
+if (CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE")
+ check_ipo_supported(RESULT _result)
+ if (_result)
+ option(VPP_USE_LTO "Link time optimization of release binaries" ON)
+ endif()
+endif()
+
+if(VPP_USE_LTO)
+ check_c_compiler_flag("-Wno-stringop-overflow"
+ compiler_flag_no_stringop_overflow)
+endif()
+##############################################################################
+# sanitizers
+##############################################################################
+
+option(VPP_ENABLE_SANITIZE_ADDR "Enable Address Sanitizer" OFF)
+set(VPP_SANITIZE_ADDR_OPTIONS
+ "unmap_shadow_on_exit=1:disable_coredump=0:abort_on_error=1:detect_leaks=0"
+ CACHE
+ STRING "Address sanitizer arguments"