diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-05-18 16:27:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-18 16:27:05 +0200 |
commit | c40872acbddb61fd084203af60a86c7ec404d716 (patch) | |
tree | 9a9e89e0c103ffc4826f0dc7c03a7e81a4c85fa7 | |
parent | ef64e225f6f6c01280aa8472bebe812016f357bf (diff) | |
download | rneovim-c40872acbddb61fd084203af60a86c7ec404d716.tar.gz rneovim-c40872acbddb61fd084203af60a86c7ec404d716.tar.bz2 rneovim-c40872acbddb61fd084203af60a86c7ec404d716.zip |
build: remove duplicate include directories in --version output
Having the same directory listed multiple times makes the --version
output needlessly complicated to visualize. This deduplication will only
work for cmake version 3.15 and above, which should be the majority of
neovim builds by now. For older cmake versions we default to the
previous behavior of listing duplicate include directories.
-rw-r--r-- | cmake.config/CMakeLists.txt | 7 | ||||
-rw-r--r-- | cmake.config/versiondef.h.in | 2 | ||||
-rw-r--r-- | cmake.config/versiondef_old.h.in | 21 |
3 files changed, 28 insertions, 2 deletions
diff --git a/cmake.config/CMakeLists.txt b/cmake.config/CMakeLists.txt index 6bf4a60cf1..26a7a262c1 100644 --- a/cmake.config/CMakeLists.txt +++ b/cmake.config/CMakeLists.txt @@ -158,7 +158,12 @@ configure_file ( "${PROJECT_BINARY_DIR}/cmake.config/auto/config.h" ) -configure_file(versiondef.h.in auto/versiondef.h.gen) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.15) + configure_file(versiondef.h.in auto/versiondef.h.gen) +else() + configure_file(versiondef_old.h.in auto/versiondef.h.gen) +endif() + file(GENERATE OUTPUT "${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef-$<CONFIG>.h" INPUT "${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef.h.gen") diff --git a/cmake.config/versiondef.h.in b/cmake.config/versiondef.h.in index a4c0cfa2d9..b328c1fa00 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} $<$<CONFIG:Debug>:${CMAKE_C_FLAGS_DEBUG}>$<$<CONFIG:Release>:${CMAKE_C_FLAGS_RELEASE}>$<$<CONFIG:RelWithDebInfo>:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$<CONFIG:MinSizeRel>:${CMAKE_C_FLAGS_MINSIZEREL}> $<JOIN:$<TARGET_PROPERTY:nvim,COMPILE_OPTIONS>, > -D$<JOIN:$<TARGET_PROPERTY:nvim,COMPILE_DEFINITIONS>, -D> -I$<JOIN:$<TARGET_PROPERTY:nvim,INCLUDE_DIRECTORIES>, -I>" +#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $<$<CONFIG:Debug>:${CMAKE_C_FLAGS_DEBUG}>$<$<CONFIG:Release>:${CMAKE_C_FLAGS_RELEASE}>$<$<CONFIG:RelWithDebInfo>:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$<CONFIG:MinSizeRel>:${CMAKE_C_FLAGS_MINSIZEREL}> $<JOIN:$<TARGET_PROPERTY:nvim,COMPILE_OPTIONS>, > -D$<JOIN:$<TARGET_PROPERTY:nvim,COMPILE_DEFINITIONS>, -D> -I$<JOIN:$<REMOVE_DUPLICATES:$<TARGET_PROPERTY:nvim,INCLUDE_DIRECTORIES>>, -I>" #define NVIM_VERSION_BUILD_TYPE "$<CONFIG>" #endif // AUTO_VERSIONDEF_H diff --git a/cmake.config/versiondef_old.h.in b/cmake.config/versiondef_old.h.in new file mode 100644 index 0000000000..a4c0cfa2d9 --- /dev/null +++ b/cmake.config/versiondef_old.h.in @@ -0,0 +1,21 @@ +#ifndef AUTO_VERSIONDEF_H +#define AUTO_VERSIONDEF_H + +#define NVIM_VERSION_MAJOR @NVIM_VERSION_MAJOR@ +#define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@ +#define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@ +#define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@" + +#cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@" +#ifndef NVIM_VERSION_MEDIUM +# include "auto/versiondef_git.h" +#endif + +#define NVIM_API_LEVEL @NVIM_API_LEVEL@ +#define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@ +#define NVIM_API_PRERELEASE @NVIM_API_PRERELEASE@ + +#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $<$<CONFIG:Debug>:${CMAKE_C_FLAGS_DEBUG}>$<$<CONFIG:Release>:${CMAKE_C_FLAGS_RELEASE}>$<$<CONFIG:RelWithDebInfo>:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$<CONFIG:MinSizeRel>:${CMAKE_C_FLAGS_MINSIZEREL}> $<JOIN:$<TARGET_PROPERTY:nvim,COMPILE_OPTIONS>, > -D$<JOIN:$<TARGET_PROPERTY:nvim,COMPILE_DEFINITIONS>, -D> -I$<JOIN:$<TARGET_PROPERTY:nvim,INCLUDE_DIRECTORIES>, -I>" +#define NVIM_VERSION_BUILD_TYPE "$<CONFIG>" + +#endif // AUTO_VERSIONDEF_H |