Commit 68a03ddc authored by Thien Nguyen's avatar Thien Nguyen
Browse files

TNQVM to export its version info in the install folder

parent db881c31
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -35,6 +35,20 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
option(TNQVM_BUILD_TESTS "Build test programs" ON)
option(TNQVM_BUILD_EXAMPLES "Build example programs" ON)

# Version info
set(MAJOR_VERSION 1)
set(MINOR_VERSION 0)
set(PATCH_VERSION 0)
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
    execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
        OUTPUT_VARIABLE TNQVM_BUILD_VERSION ERROR_QUIET
        OUTPUT_STRIP_TRAILING_WHITESPACE)
    message(STATUS "TNQVM GIT hash: ${TNQVM_BUILD_VERSION}")
endif()
configure_file("${CMAKE_SOURCE_DIR}/cmake/tnqvm-config.cmake.in" "${CMAKE_BINARY_DIR}/tnqvm-config.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/tnqvm-config.cmake" DESTINATION .)

if (NOT CMAKE_BUILD_TYPE)
  # Default build type is "Release" if not specified
  message(STATUS "CMAKE_BUILD_TYPE was not specified. Default to \"Release\".")
+9 −0
Original line number Diff line number Diff line
# - Config file for TNQVM

# Define version info 

set(TNQVM_VERSION_MAJOR @MAJOR_VERSION@)
set(TNQVM_VERSION_MINOR @MINOR_VERSION@)
set(TNQVM_VERSION_PATCH @PATCH_VERSION@)
set(TNQVM_VERSION_SUFFIX @TNQVM_BUILD_VERSION@)
set(TNQVM_VERSION "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@-@TNQVM_BUILD_VERSION@")
 No newline at end of file