diff --git a/CMakeLists.txt b/CMakeLists.txt index 95131765f..bbcd456fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,17 @@ cmake_minimum_required(VERSION 3.15.0) + +include(cmake/GetVersion.cmake) +get_mapnik_version() + project(mapnik - VERSION 3.0.24 + VERSION ${MAPNIK_MAJOR_VERSION}.${MAPNIK_MINOR_VERSION}.${MAPNIK_PATCH_VERSION} HOMEPAGE_URL "https://mapnik.org/" DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications" LANGUAGES CXX ) +message(STATUS "mapnik version: ${PROJECT_VERSION}") + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully" "") diff --git a/cmake/GetVersion.cmake b/cmake/GetVersion.cmake new file mode 100644 index 000000000..8c512645b --- /dev/null +++ b/cmake/GetVersion.cmake @@ -0,0 +1,12 @@ +macro(get_mapnik_version) + file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/mapnik/version.hpp VERSION_FILE) + + string(REGEX MATCH "MAPNIK_MAJOR_VERSION ([0-9]*)" _ ${VERSION_FILE}) + set(MAPNIK_MAJOR_VERSION ${CMAKE_MATCH_1}) + + string(REGEX MATCH "MAPNIK_MINOR_VERSION ([0-9]*)" _ ${VERSION_FILE}) + set(MAPNIK_MINOR_VERSION ${CMAKE_MATCH_1}) + + string(REGEX MATCH "MAPNIK_PATCH_VERSION ([0-9]*)" _ ${VERSION_FILE}) + set(MAPNIK_PATCH_VERSION ${CMAKE_MATCH_1}) +endmacro()