+# release
+list(APPEND BUILD_TYPES "release")
+string(CONCAT CMAKE_C_FLAGS_RELEASE
+ "-O2 "
+ "-fstack-protector "
+ "-DFORTIFY_SOURCE=2 "
+ "-fno-common "
+)
+
+string(CONCAT CMAKE_EXE_LINKER_FLAGS_RELEASE "-pie")
+
+# debug
+list(APPEND BUILD_TYPES "debug")
+string(CONCAT CMAKE_C_FLAGS_DEBUG
+ "-O0 "
+ "-DCLIB_DEBUG "
+ "-fstack-protector "
+ "-DFORTIFY_SOURCE=2 "
+ "-fno-common "
+)
+
+# coverity
+list(APPEND BUILD_TYPES "coverity")
+string(CONCAT CMAKE_C_FLAGS_COVERITY "-O2 -D__COVERITY__")
+
+# gcov
+list(APPEND BUILD_TYPES "gcov")
+string(CONCAT CMAKE_C_FLAGS_GCOV
+ "-O0 "
+ "-DCLIB_DEBUG "
+ "-DCLIB_GCOV "
+ "-fprofile-arcs "
+ "-ftest-coverage ")
+
+string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UC)
+
+
+string(REPLACE ";" " " BUILD_TYPES "${BUILD_TYPES}")
+set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
+ HELPSTRING "Build type - valid options are: ${BUILD_TYPES}")
+
+##############################################################################
+# 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()
+
+##############################################################################
+# 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"
+)
+
+if (VPP_ENABLE_SANITIZE_ADDR)
+ set(CMAKE_C_FLAGS "-fsanitize=address -DCLIB_SANITIZE_ADDR ${CMAKE_C_FLAGS}")
+ set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=address ${CMAKE_EXE_LINKER_FLAGS}")
+ set(CMAKE_SHARED_LINKER_FLAGS "-fsanitize=address ${CMAKE_SHARED_LINKER_FLAGS}")
+endif (VPP_ENABLE_SANITIZE_ADDR)
+