Skip to content
Snippets Groups Projects
Unverified Commit e906920d authored by Christian Willner's avatar Christian Willner Committed by GitHub
Browse files

feat(project-template): add VersionInfo.h generation (#40)

parent 1dcc99e7
No related branches found
No related tags found
No related merge requests found
......@@ -35,3 +35,12 @@ endif( ${PROJECT_NAME}_BUILDVERSION )
set(${PROJECT_NAME}_FULL_LIBRARY_VERSION ${${PROJECT_NAME}_SOVERSION}.${${PROJECT_NAME}_PATCH_VERSION})
# The following generates a cpp header file that can be used to access the CMAKE version info.
# The "VersionInfo.h" is available in the project's build directory and included in the build.
string(REGEX REPLACE "^0" "" ${PROJECT_NAME}_MAJOR_VERSION_INT ${${PROJECT_NAME}_MAJOR_VERSION})
string(REGEX REPLACE "^0" "" ${PROJECT_NAME}_MINOR_VERSION_INT ${${PROJECT_NAME}_MINOR_VERSION})
string(REGEX REPLACE "^0" "" ${PROJECT_NAME}_PATCH_VERSION_INT ${${PROJECT_NAME}_PATCH_VERSION})
configure_file(cmake/version_info_template.h.in "${PROJECT_BINARY_DIR}/generated/VersionInfo.h")
include_directories(${PROJECT_BINARY_DIR}/generated)
#pragma once
namespace ChimeraTK::VersionInfo {
const int major{${${PROJECT_NAME}_MAJOR_VERSION_INT}};
const int minor{${${PROJECT_NAME}_MINOR_VERSION_INT}};
const int applicationPatch{${${PROJECT_NAME}_PATCH_VERSION_INT}};
} // namespace ChimeraTK::VersionInfo
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment