diff --git a/CMakeLists.txt b/CMakeLists.txt index db13de81..86aac285 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,7 @@ endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include (${CMAKE_CURRENT_LIST_DIR}/cmake/generate_version_file.cmake) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/netgen_version.hpp DESTINATION ${NG_INSTALL_DIR_INCLUDE}/include COMPONENT netgen_devel) set(CPACK_PACKAGE_VERSION "${NETGEN_VERSION}") diff --git a/cmake/generate_version_file.cmake b/cmake/generate_version_file.cmake index 3b913636..eb1a5e35 100644 --- a/cmake/generate_version_file.cmake +++ b/cmake/generate_version_file.cmake @@ -36,7 +36,17 @@ endif() set(NETGEN_VERSION_LONG ${NETGEN_VERSION_SHORT}-${NETGEN_VERSION_TWEAK}-${NETGEN_VERSION_HASH}) set(version_file ${BDIR}/netgen_version.hpp) -set(new_version_file_string "#define NETGEN_VERSION \"${NETGEN_VERSION}\"\n") +set(new_version_file_string "\ +#ifndef NETGEN_VERSION_HPP_INCLUDED +#define NETGEN_VERSION_HPP_INCLUDED +#define NETGEN_VERSION \"${NETGEN_VERSION}\" +#define NETGEN_VERSION_MAJOR ${NETGEN_VERSION_MAJOR} +#define NETGEN_VERSION_MINOR ${NETGEN_VERSION_MINOR} +#define NETGEN_VERSION_PATCH ${NETGEN_VERSION_PATCH} +#define NETGEN_VERSION_TWEAK ${NETGEN_VERSION_TWEAK} +#define NETGEN_VERSION_HASH \"${NETGEN_VERSION_HASH}\" +#endif // NETGEN_VERSION_HPP_INCLUDED +") if(EXISTS ${version_file}) file(READ ${version_file} old_version_file_string ) if(${old_version_file_string} STREQUAL ${new_version_file_string}) diff --git a/libsrc/core/archive.cpp b/libsrc/core/archive.cpp index 84e6d875..5d968b6c 100644 --- a/libsrc/core/archive.cpp +++ b/libsrc/core/archive.cpp @@ -1,5 +1,6 @@ #include "archive.hpp" +#include #ifndef WIN32 #include @@ -44,4 +45,10 @@ namespace ngcore std::make_unique>(); return type_register->count(classname) != 0; } + + + static bool dummy = [](){ + SetLibraryVersion("netgen", NETGEN_VERSION); + return true; + }(); } // namespace ngcore