diff --git a/CMakeLists.txt b/CMakeLists.txt index c40920f83..ad0c4213e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ message(STATUS "mapnik version: ${PROJECT_VERSION}") set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +include(MapnikMinimumVersions) include(MapnikFindPackage) include(MapnikCopyDependencies) include(MapnikInstall) @@ -133,7 +134,7 @@ endif() find_package(PkgConfig) mapnik_find_threads() mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) -mapnik_find_package(Boost 1.61 REQUIRED COMPONENTS filesystem system regex) +mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS filesystem system regex) if(USE_BOOST_REGEX_ICU_WORKAROUND) message(STATUS "using boost regex workaround") set_property(TARGET Boost::regex PROPERTY INTERFACE_LINK_LIBRARIES) @@ -142,15 +143,14 @@ endif() mapnik_find_package(Freetype REQUIRED) # try to find harfbuzz with the native configuration and fallback to our "own" FindHarfBuzz -set(HARFBUZZ_MINIMUM_VERSION 0.9.34) -mapnik_find_package(harfbuzz CONFIG QUIET) +mapnik_find_package(harfbuzz ${HARFBUZZ_MIN_VERSION} CONFIG QUIET) if(harfbuzz_FOUND) message(STATUS "Found harfbuzz native cmake") list(APPEND MAPNIK_OPTIONAL_LIBS harfbuzz::harfbuzz) else() # we use our "own" FindHarfBuzz. See https://github.com/mapnik/mapnik/pull/4191#issuecomment-874728157 for more details message(STATUS "Fallback to FindHarfBuzz") - mapnik_find_package(HarfBuzz ${HARFBUZZ_MINIMUM_VERSION} REQUIRED COMPONENTS ICU) + mapnik_find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED COMPONENTS ICU) list(APPEND MAPNIK_OPTIONAL_LIBS HarfBuzz::HarfBuzz HarfBuzz::ICU) endif() @@ -297,11 +297,11 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ QUIET) + mapnik_find_package(PROJ ${PROJ_MIN_VERSION} QUIET) # currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config if(NOT PROJ_FOUND) message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...") - pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj) + pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj>=${PROJ_MIN_VERSION}) string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _dummy "${PROJ_VERSION}") set(PROJ_VERSION_MAJOR "${CMAKE_MATCH_1}") set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}") @@ -311,7 +311,7 @@ if(USE_PROJ) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE $) endif() if(USE_GRID_RENDERER) diff --git a/cmake/MapnikMinimumVersions.cmake b/cmake/MapnikMinimumVersions.cmake new file mode 100644 index 000000000..b4ae45924 --- /dev/null +++ b/cmake/MapnikMinimumVersions.cmake @@ -0,0 +1,3 @@ +set(BOOST_MIN_VERSION 1.61) +set(HARFBUZZ_MIN_VERSION 0.9.34) +set(PROJ_MIN_VERSION 7.2.0) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9724cd33c..bea2742c0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ project(mapnik-test) -find_package(Boost REQUIRED COMPONENTS program_options) +find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) find_package(PostgreSQL REQUIRED) include(FetchContent) diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index d6ae7974d..f9e568474 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -1,6 +1,6 @@ project(mapnik-index) -find_package(Boost REQUIRED COMPONENTS program_options) +find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) add_executable(mapnik-index mapnik-index.cpp diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 2125c60a0..705482350 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -1,6 +1,6 @@ project(mapnik-render) -find_package(Boost REQUIRED COMPONENTS program_options) +find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) add_executable(mapnik-render mapnik-render.cpp) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 7e79a0bd0..1412e4dd6 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -1,5 +1,5 @@ project(pgsql2sqlite) -find_package(Boost REQUIRED COMPONENTS program_options) +find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) find_package(SQLite3 REQUIRED) find_package(PostgreSQL REQUIRED) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index ba535b170..c3ddb9208 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -1,6 +1,6 @@ project(shapeindex) -find_package(Boost REQUIRED COMPONENTS program_options) +find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) add_executable(shapeindex shapeindex.cpp diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index 328197611..7dce53fbe 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -1,6 +1,6 @@ project(svg2png) -find_package(Boost REQUIRED COMPONENTS program_options) +find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) add_executable(svg2png svg2png.cpp