build: add build types helpstring to cmake project 46/23546/3
authorDamjan Marion <damarion@cisco.com>
Tue, 19 Nov 2019 16:58:36 +0000 (17:58 +0100)
committerFlorin Coras <florin.coras@gmail.com>
Fri, 22 Nov 2019 19:01:44 +0000 (19:01 +0000)
Type: feature

Change-Id: Ia016fee107859d5ad22fe7959c8e9d32758e0787
Signed-off-by: Damjan Marion <damarion@cisco.com>
src/CMakeLists.txt

index b8ffc07..4fa9e5a 100644 (file)
@@ -61,6 +61,7 @@ if (compiler_flag_no_address_of_packed_member)
 endif()
 
 # release
+list(APPEND BUILD_TYPES "release")
 string(CONCAT CMAKE_C_FLAGS_RELEASE
   "-O2 "
   "-fstack-protector "
@@ -71,6 +72,7 @@ string(CONCAT CMAKE_C_FLAGS_RELEASE
 string(CONCAT CMAKE_EXE_LINKER_FLAGS_RELEASE "-pie")
 
 # debug
+list(APPEND BUILD_TYPES "debug")
 string(CONCAT CMAKE_C_FLAGS_DEBUG
   "-O0 "
   "-DCLIB_DEBUG "
@@ -80,9 +82,11 @@ string(CONCAT CMAKE_C_FLAGS_DEBUG
 )
 
 # 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 "
@@ -92,6 +96,11 @@ string(CONCAT CMAKE_C_FLAGS_GCOV
 
 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}")
+
 ##############################################################################
 # install config
 ##############################################################################