From 3a533cd561eb75deab489d5ab39a7ec4e1bf7952 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Mon, 3 May 2021 12:40:27 +0200 Subject: build: add set-build-type-* targets to CMake Type: make Change-Id: Icf37873b461cd034567dc1b99e23d1bbb3f4b9f0 Signed-off-by: Damjan Marion --- src/CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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 ############################################################################## -- cgit 1.2.3-korg