aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-05-03 12:40:27 +0200
committerDamjan Marion <dmarion@me.com>2021-05-04 07:18:17 +0000
commit3a533cd561eb75deab489d5ab39a7ec4e1bf7952 (patch)
treefa03c3a87b414b924bd20aae09932a2b77441c4b
parentba9cb1ba377b2ec7b2876822d73db848e7fa6754 (diff)
build: add set-build-type-* targets to CMake
Type: make Change-Id: Icf37873b461cd034567dc1b99e23d1bbb3f4b9f0 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rwxr-xr-xconfigure15
-rw-r--r--src/CMakeLists.txt12
2 files changed, 18 insertions, 9 deletions
diff --git a/configure b/configure
index 2c3f4990395..384cfcf956e 100755
--- a/configure
+++ b/configure
@@ -85,12 +85,13 @@ cmake \
Useful build commands:
- ninja Build VPP
- ninja config Start build configuration TUI
- ninja compdb Generate compile_commands.json
- ninja run Runs VPP using startup.conf in the build directory
- ninja debug Runs VPP inside GDB using startup.conf in the build directory
- ninja pkg-deb Create .deb packages
- ninja install Install VPP to $install_dir
+ ninja Build VPP
+ ninja set-build-type-* Change build type to <debug|release|gcov|...>
+ ninja config Start build configuration TUI
+ ninja compdb Generate compile_commands.json
+ ninja run Runs VPP using startup.conf in the build directory
+ ninja debug Runs VPP inside GDB using startup.conf in the build directory
+ ninja pkg-deb Create .deb packages
+ ninja install Install VPP to $install_dir
__EOF__
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a291c4d022d..cb05a087b6c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -110,9 +110,9 @@ string(CONCAT CMAKE_C_FLAGS_GCOV
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UC)
-string(REPLACE ";" " " BUILD_TYPES "${BUILD_TYPES}")
+string(REPLACE ";" " " BUILD_TYPES_STR "${BUILD_TYPES}")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
- HELPSTRING "Build type - valid options are: ${BUILD_TYPES}")
+ HELPSTRING "Build type - valid options are: ${BUILD_TYPES_STR}")
##############################################################################
# link time optimizations
@@ -245,6 +245,14 @@ add_custom_target(compdb
USES_TERMINAL
)
+foreach(bt ${BUILD_TYPES})
+ add_custom_target(set-build-type-${bt}
+ COMMAND cmake -DCMAKE_BUILD_TYPE:STRING=${bt} .
+ COMMENT "Changing build type to ${bt}"
+ USES_TERMINAL
+ )
+endforeach()
+
##############################################################################
# print configuration
##############################################################################