+ set(CMAKE_C_FLAGS "-Wno-address-of-packed-member ${CMAKE_C_FLAGS}")
+endif()
+
+# release
+list(APPEND BUILD_TYPES "release")
+string(CONCAT CMAKE_C_FLAGS_RELEASE
+ "-O2 "
+ "-fstack-protector "
+ "-D_FORTIFY_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 "
+ "-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()