add basic pkg-config exports
This commit is contained in:
parent
a2d3364ec7
commit
fcc7016124
4 changed files with 61 additions and 2 deletions
|
@ -103,6 +103,7 @@ set(MAPNIK_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Install directory for l
|
|||
set(MAPNIK_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Install directory for archives")
|
||||
set(MAPNIK_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING "Install directory for the headers")
|
||||
set(MAPNIK_CMAKE_DIR ${MAPNIK_LIB_DIR}/cmake/mapnik CACHE STRING "Install directory of the cmake targets")
|
||||
set(MAPNIK_PKGCONF_DIR ${MAPNIK_LIB_DIR}/pkgconfig CACHE STRING "Install directory for the .pc files for pkg-config")
|
||||
|
||||
if(WIN32)
|
||||
set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_BIN_DIR}/mapnik/input)
|
||||
|
@ -374,6 +375,7 @@ endif()
|
|||
|
||||
# start package mapnik
|
||||
include(MapnikExport)
|
||||
include(MapnikExportPkgConfig)
|
||||
|
||||
install(DIRECTORY include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
install(DIRECTORY deps/agg/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
|
|
57
cmake/MapnikExportPkgConfig.cmake
Normal file
57
cmake/MapnikExportPkgConfig.cmake
Normal file
|
@ -0,0 +1,57 @@
|
|||
function(create_pkg_config_file _lib_name _description)
|
||||
string(CONFIGURE [[
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
Name: @_lib_name@
|
||||
Description: @_description@
|
||||
Version: @MAPNIK_VERSION@
|
||||
Libs: -L"${libdir}" -l@_lib_name@
|
||||
Cflags: -I"${includedir}" ]]
|
||||
_contents @ONLY)
|
||||
|
||||
file(GENERATE
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
||||
CONTENT "${_contents}"
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
||||
DESTINATION ${MAPNIK_PKGCONF_DIR}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(create_pkg_config_file_mapnik _lib_name _description)
|
||||
get_target_property(_compile_defs core INTERFACE_COMPILE_DEFINITIONS)
|
||||
string(JOIN " -D" _str_compile_defs ${_compile_defs})
|
||||
if(_str_compile_defs)
|
||||
set(_str_compile_defs "-D${_str_compile_defs}")
|
||||
endif()
|
||||
string(CONFIGURE [[
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
Name: @_lib_name@
|
||||
Description: @_description@
|
||||
Version: @MAPNIK_VERSION@
|
||||
Requires: libmapnikwkt libmapnikjson
|
||||
Libs: -L"${libdir}" -l@_lib_name@ -llibmapnikwkt -llibmapnikjson
|
||||
Cflags: -I"${includedir}" @_str_compile_defs@]]
|
||||
_contents @ONLY)
|
||||
file(GENERATE
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
||||
CONTENT "${_contents}"
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
||||
DESTINATION ${MAPNIK_PKGCONF_DIR}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
|
||||
create_pkg_config_file(libmapnikwkt "wkt library")
|
||||
create_pkg_config_file(libmapnikjson "json library")
|
||||
create_pkg_config_file_mapnik("libmapnik" "mapnik library")
|
|
@ -28,7 +28,7 @@ set_target_properties(json PROPERTIES
|
|||
POSITION_INDEPENDENT_CODE ON
|
||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||
OUTPUT_NAME "json"
|
||||
PREFIX "libmapnik-"
|
||||
PREFIX "libmapnik"
|
||||
VERSION ${MAPNIK_VERSION}
|
||||
# see mapnik target for explanation
|
||||
SOVERSION ${MAPNIK_VERSION}
|
||||
|
|
|
@ -20,7 +20,7 @@ set_target_properties(wkt PROPERTIES
|
|||
POSITION_INDEPENDENT_CODE ON
|
||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||
OUTPUT_NAME "wkt"
|
||||
PREFIX "libmapnik-"
|
||||
PREFIX "libmapnik"
|
||||
VERSION ${MAPNIK_VERSION}
|
||||
# see mapnik target for explanation
|
||||
SOVERSION ${MAPNIK_VERSION}
|
||||
|
|
Loading…
Reference in a new issue