From 7100a80253a353341893e1f6397cc9e07dadbc9d Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 4 Mar 2023 20:04:01 +0100 Subject: [PATCH] build: show build type specific compiler flags when using --version The build type specific flags are defined in the variables CMAKE_C_FLAGS_, where can be DEBUG, RELEASE, RELWITHDEBINFO and MINSIZEREL. --- CMakeLists.txt | 1 + cmake.config/versiondef.h.in | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b89718ebd..266ac0354b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,7 @@ endif() if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG) string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") string(REPLACE "/DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + string(REPLACE " " " " CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") # Remove duplicate whitespace endif() option(LOG_LIST_ACTIONS "Add list actions logging" OFF) diff --git a/cmake.config/versiondef.h.in b/cmake.config/versiondef.h.in index 2bfd4e0b53..a4c0cfa2d9 100644 --- a/cmake.config/versiondef.h.in +++ b/cmake.config/versiondef.h.in @@ -15,7 +15,7 @@ #define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@ #define NVIM_API_PRERELEASE @NVIM_API_PRERELEASE@ -#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $, > -D$, -D> -I$, -I>" +#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $<$:${CMAKE_C_FLAGS_DEBUG}>$<$:${CMAKE_C_FLAGS_RELEASE}>$<$:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$:${CMAKE_C_FLAGS_MINSIZEREL}> $, > -D$, -D> -I$, -I>" #define NVIM_VERSION_BUILD_TYPE "$" #endif // AUTO_VERSIONDEF_H