From f32070b9cbb02726dc074cdde36d261df5f846d8 Mon Sep 17 00:00:00 2001 From: Benjamin Winger Date: Mon, 20 Nov 2023 10:34:02 -0500 Subject: [PATCH] Define KUZU_VERSION as an extern global Since it's set using a compile definition, we want to avoid that definition being required to include the header --- src/common/CMakeLists.txt | 1 + src/common/constants.cpp | 6 ++++++ src/include/common/constants.h | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/common/constants.cpp diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 680ffcd75c..7bbbc189ac 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -10,6 +10,7 @@ add_subdirectory(vector) add_library(kuzu_common OBJECT + constants.cpp expression_type.cpp file_utils.cpp in_mem_overflow_buffer.cpp diff --git a/src/common/constants.cpp b/src/common/constants.cpp new file mode 100644 index 0000000000..3c2a823d60 --- /dev/null +++ b/src/common/constants.cpp @@ -0,0 +1,6 @@ +namespace kuzu { +namespace common { + +const char* KUZU_VERSION = KUZU_CMAKE_VERSION; +} +} // namespace kuzu diff --git a/src/include/common/constants.h b/src/include/common/constants.h index 11092b2fe6..2d3fee9dc1 100644 --- a/src/include/common/constants.h +++ b/src/include/common/constants.h @@ -5,7 +5,7 @@ namespace kuzu { namespace common { -constexpr char KUZU_VERSION[] = KUZU_CMAKE_VERSION; +extern const char* KUZU_VERSION; constexpr uint64_t DEFAULT_VECTOR_CAPACITY_LOG_2 = 11; constexpr uint64_t DEFAULT_VECTOR_CAPACITY = (uint64_t)1 << DEFAULT_VECTOR_CAPACITY_LOG_2;