1
0
mirror of https://github.com/bitdefender/bddisasm.git synced 2024-12-22 22:18:09 +00:00

Extract version information from version.h

This is done so we have a single place that holds versioning information. While it would be easier to generate the DISASM_VERSION_* definitions based on the PROJECT_VERSION_* values, doing this for Visual Studio builds that do not use CMake is not trivial
This commit is contained in:
Ionel-Cristinel ANICHITEI 2020-11-17 12:44:10 +02:00
parent f5d91d7cb5
commit 190d3e59f3
2 changed files with 13 additions and 2 deletions

View File

@ -2,8 +2,20 @@ cmake_minimum_required(VERSION 3.12)
include("${CMAKE_CURRENT_LIST_DIR}/project-meta-info.in")
set(disasm_version_file ${CMAKE_SOURCE_DIR}/inc/version.h)
file(STRINGS ${disasm_version_file} disasm_ver_major REGEX "DISASM_VERSION_MAJOR")
file(STRINGS ${disasm_version_file} disasm_ver_minor REGEX "DISASM_VERSION_MINOR")
file(STRINGS ${disasm_version_file} disasm_ver_patch REGEX "DISASM_VERSION_REVISION")
string(REGEX REPLACE "#define DISASM_VERSION_MAJOR[ \t\r\n]*" "" disasm_ver_major ${disasm_ver_major})
string(REGEX REPLACE "#define DISASM_VERSION_MINOR[ \t\r\n]*" "" disasm_ver_minor ${disasm_ver_minor})
string(REGEX REPLACE "#define DISASM_VERSION_REVISION[ \t\r\n]*" "" disasm_ver_patch ${disasm_ver_patch})
message(STATUS "Extracted version from ${disasm_version_file}: ${disasm_ver_major}.${disasm_ver_minor}.${disasm_ver_patch}")
project(bddisasm
VERSION ${project_version}
VERSION ${disasm_ver_major}.${disasm_ver_minor}.${disasm_ver_patch}
DESCRIPTION ${project_description}
LANGUAGES C
)

View File

@ -1,4 +1,3 @@
# project-meta-info.in
set(project_version 1.31.3)
set(project_description "Bitdefender x86 instruction decoder and emulator")