diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0aa1f0188..93385a839 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ endif()
cmake_policy(SET CMP0111 OLD)
project(
MrDocs
- VERSION 1.0.0
+ VERSION 0.0.1
DESCRIPTION "C++ Documentation Tool"
HOMEPAGE_URL "https://github.com/cppalliance/mrdocs"
LANGUAGES CXX C
@@ -115,12 +115,31 @@ unset(CMAKE_FOLDER)
# mrdocs-core
#
#-------------------------------------------------
+# Create include/mrdocs/Version.hpp from Version.hpp.in
+find_package(Git QUIET)
+if (GIT_FOUND)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ OUTPUT_VARIABLE PROJECT_VERSION_BUILD
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ set(PROJECT_VERSION_BUILD "${PROJECT_VERSION_BUILD}")
+else()
+ set(PROJECT_VERSION_BUILD "")
+endif()
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/mrdocs/Version.hpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/include/mrdocs/Version.hpp
+ @ONLY
+)
file(
GLOB_RECURSE LIB_SOURCES CONFIGURE_DEPENDS
src/lib/*.cpp src/lib/*.hpp src/lib/*.ipp
src/lib/*.natvis
include/*.hpp include/*.ipp
+ ${CMAKE_CURRENT_BINARY_DIR}/src/lib/*.hpp
include/*.natvis
SourceFileNames.cpp)
add_library(mrdocs-core ${LIB_SOURCES})
@@ -128,6 +147,7 @@ target_compile_features(mrdocs-core PUBLIC cxx_std_20)
target_include_directories(mrdocs-core
PUBLIC
"$"
+ "$"
"$"
PRIVATE
"${PROJECT_SOURCE_DIR}/src"
@@ -407,6 +427,12 @@ if (MRDOCS_INSTALL)
FILES_MATCHING
PATTERN "*.[hi]pp")
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/mrdocs
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT development
+ FILES_MATCHING
+ PATTERN "*.[hi]pp")
+
#-------------------------------------------------
# share
#-------------------------------------------------
diff --git a/include/mrdocs/Version.hpp b/include/mrdocs/Version.hpp
deleted file mode 100644
index b12a12b5f..000000000
--- a/include/mrdocs/Version.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// Licensed under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-// Copyright (c) 2023 Klemens D. Morgenstern
-//
-// Official repository: https://github.com/cppalliance/mrdocs
-//
-
-#ifndef MRDOCS_VERSION_HPP
-#define MRDOCS_VERSION_HPP
-
-#include
-
-namespace clang {
-namespace mrdocs {
-
-constexpr std::string_view project_version = "1.0.0";
-constexpr std::string_view project_name = "MrDocs";
-constexpr std::string_view project_description = "C++ Documentation Tool";
-
-} // mrdocs
-} // clang
-
-#endif
diff --git a/include/mrdocs/Version.hpp.in b/include/mrdocs/Version.hpp.in
new file mode 100644
index 000000000..9b91420a8
--- /dev/null
+++ b/include/mrdocs/Version.hpp.in
@@ -0,0 +1,30 @@
+//
+// Licensed under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// Copyright (c) 2023 Klemens D. Morgenstern
+//
+// Official repository: https://github.com/cppalliance/mrdocs
+//
+
+#ifndef MRDOCS_VERSION_HPP
+#define MRDOCS_VERSION_HPP
+
+#include
+
+namespace clang {
+namespace mrdocs {
+
+constexpr std::string_view project_version = "@PROJECT_VERSION@";
+constexpr std::size_t project_version_major = @PROJECT_VERSION_MAJOR@;
+constexpr std::size_t project_version_minor = @PROJECT_VERSION_MINOR@;
+constexpr std::size_t project_version_patch = @PROJECT_VERSION_PATCH@;
+constexpr std::string_view project_version_build = "@PROJECT_VERSION_BUILD@";
+constexpr std::string_view project_name = "@PROJECT_NAME@";
+constexpr std::string_view project_description = "@PROJECT_DESCRIPTION@";
+
+} // mrdocs
+} // clang
+
+#endif