#------------------------------------------------------------------- # This file is part of the CMake build system for Hydrax # # The contents of this file are placed in the public domain. Feel # free to make use of it in any way you like. #------------------------------------------------------------------- macro(get_preprocessor_entry CONTENTS KEYWORD VARIABLE) string(REGEX MATCH "# *define +${KEYWORD} +((\"([^\n]*)\")|([^ \n]*))" PREPROC_TEMP_VAR ${${CONTENTS}} ) if (CMAKE_MATCH_3) set(${VARIABLE} ${CMAKE_MATCH_3}) else () set(${VARIABLE} ${CMAKE_MATCH_4}) endif () endmacro() macro(hydrax_get_version HEADER) file(READ ${HEADER} TEMP_VAR_CONTENTS) get_preprocessor_entry(TEMP_VAR_CONTENTS HYDRAX_VERSION_MAJOR HYDRAX_VERSION_MAJOR) get_preprocessor_entry(TEMP_VAR_CONTENTS HYDRAX_VERSION_MINOR HYDRAX_VERSION_MINOR) get_preprocessor_entry(TEMP_VAR_CONTENTS HYDRAX_VERSION_PATCH HYDRAX_VERSION_PATCH) set(HYDRAX_VERSION "${HYDRAX_VERSION_MAJOR}.${HYDRAX_VERSION_MINOR}.${HYDRAX_VERSION_PATCH}") endmacro()