You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PDCursesMod/cmake/get_version.cmake

18 lines
816 B
CMake

file(READ ${CMAKE_SOURCE_DIR}/curses.h _CURSES_H_CONTENTS)
string(REGEX MATCH "#define PDC_VER_MAJOR ([a-zA-Z0-9_]+)" PDC_VER_MAJOR "${_CURSES_H_CONTENTS}")
string(REPLACE "#define PDC_VER_MAJOR " "" PDC_VER_MAJOR "${PDC_VER_MAJOR}")
string(REGEX MATCH "#define PDC_VER_MINOR ([a-zA-Z0-9_]+)" PDC_VER_MINOR "${_CURSES_H_CONTENTS}")
string(REPLACE "#define PDC_VER_MINOR " "" PDC_VER_MINOR "${PDC_VER_MINOR}")
string(REGEX MATCH "#define PDC_VER_CHANGE ([a-zA-Z0-9_]+)" PDC_VER_CHANGE "${_CURSES_H_CONTENTS}")
string(REPLACE "#define PDC_VER_CHANGE " "" PDC_VER_CHANGE "${PDC_VER_CHANGE}")
if(BUILD_NUMBER)
set(CURSES_VERSION ${PDC_VER_MAJOR}.${PDC_VER_MINOR}.${PDC_VER_CHANGE}.${BUILD_NUMBER})
else()
set(CURSES_VERSION ${PDC_VER_MAJOR}.${PDC_VER_MINOR}.${PDC_VER_CHANGE}.0)
endif()