[CMake] use pkgconf imported target for proj; see https://github.com/mapnik/mapnik/issues/4249#issuecomment-937214705
This commit is contained in:
parent
a0525ddd26
commit
1a5aea5653
1 changed files with 5 additions and 3 deletions
|
@ -303,17 +303,19 @@ if(USE_PROJ)
|
|||
# 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>=${PROJ_MIN_VERSION})
|
||||
pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj>=${PROJ_MIN_VERSION} GLOBAL)
|
||||
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}")
|
||||
set(PROJ_VERSION_PATCH "${CMAKE_MATCH_3}")
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::PROJ)
|
||||
else()
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES})
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE $<BUILD_INTERFACE:${PROJ_INCLUDE_DIRS}>)
|
||||
endif()
|
||||
math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL)
|
||||
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 $<BUILD_INTERFACE:${PROJ_INCLUDE_DIRS}>)
|
||||
endif()
|
||||
|
||||
if(USE_GRID_RENDERER)
|
||||
|
|
Loading…
Reference in a new issue