add minimum versions; proj include dir only as a build interface

This commit is contained in:
Mathis Logemann 2021-09-22 15:25:55 +02:00
parent 25774ac82a
commit 755e8d322e
8 changed files with 16 additions and 13 deletions

View file

@ -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 $<BUILD_INTERFACE:${PROJ_INCLUDE_DIRS}>)
endif()
if(USE_GRID_RENDERER)

View file

@ -0,0 +1,3 @@
set(BOOST_MIN_VERSION 1.61)
set(HARFBUZZ_MIN_VERSION 0.9.34)
set(PROJ_MIN_VERSION 7.2.0)

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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