2021-09-22 20:49:44 +02:00
|
|
|
#
|
|
|
|
# Install library targets that consuming users need.
|
|
|
|
#
|
2021-09-22 19:52:39 +02:00
|
|
|
function(mapnik_install _target)
|
|
|
|
install(TARGETS ${_target}
|
|
|
|
EXPORT MapnikTargets
|
|
|
|
INCLUDES DESTINATION ${MAPNIK_INCLUDE_DIR}
|
|
|
|
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
|
|
COMPONENT MapnikRuntime
|
|
|
|
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
|
|
COMPONENT MapnikRuntime
|
|
|
|
NAMELINK_COMPONENT MapnikDevelopment
|
|
|
|
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
|
|
COMPONENT MapnikDevelopment
|
|
|
|
)
|
|
|
|
get_target_property(TARGET_TYPE "${_target}" TYPE)
|
2021-09-22 20:49:44 +02:00
|
|
|
if (TARGET_TYPE STREQUAL "SHARED_LIBRARY")
|
|
|
|
set_property(GLOBAL APPEND PROPERTY TARGETS ${_target})
|
2021-04-10 14:36:22 +02:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2021-09-22 20:49:44 +02:00
|
|
|
#
|
|
|
|
# Install plugins
|
|
|
|
#
|
2021-09-22 19:52:39 +02:00
|
|
|
function(mapnik_install_plugin _target)
|
|
|
|
install(TARGETS ${_target}
|
|
|
|
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
|
|
|
COMPONENT MapnikPluginRuntime
|
|
|
|
LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR}
|
|
|
|
COMPONENT MapnikPluginRuntime
|
|
|
|
NAMELINK_COMPONENT MapnikPluginDevelopment
|
|
|
|
ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR}
|
|
|
|
COMPONENT MapnikPluginDevelopment
|
|
|
|
)
|
2021-09-22 20:49:44 +02:00
|
|
|
set_property(GLOBAL APPEND PROPERTY PLUGINS ${_target})
|
2021-09-22 19:52:39 +02:00
|
|
|
endfunction()
|
|
|
|
|
2021-09-22 20:49:44 +02:00
|
|
|
#
|
|
|
|
# Install executables. These are available via COMPONENTS in find_package
|
|
|
|
#
|
|
|
|
function(mapnik_install_utility _target)
|
2021-09-23 10:33:32 +02:00
|
|
|
set(_target_name "mapnikUtilityTargets_${_target}")
|
2021-09-22 20:49:44 +02:00
|
|
|
install(TARGETS ${_target}
|
|
|
|
EXPORT ${_target_name}
|
|
|
|
INCLUDES DESTINATION ${MAPNIK_INCLUDE_DIR}
|
|
|
|
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
|
|
COMPONENT MapnikRuntime
|
|
|
|
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
|
|
COMPONENT MapnikRuntime
|
|
|
|
NAMELINK_COMPONENT MapnikDevelopment
|
|
|
|
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
|
|
COMPONENT MapnikDevelopment
|
|
|
|
)
|
|
|
|
install(EXPORT ${_target_name}
|
|
|
|
FILE ${_target_name}.cmake
|
|
|
|
NAMESPACE mapnik::
|
|
|
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
|
|
|
)
|
|
|
|
set_property(GLOBAL APPEND PROPERTY MAPNIK_UTILITIES ${_target})
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
2021-04-10 14:36:22 +02:00
|
|
|
|
|
|
|
function(mapnik_install_targets)
|
2021-04-22 19:41:21 +02:00
|
|
|
if(INSTALL_DEPENDENCIES AND WIN32)
|
2021-04-10 14:36:22 +02:00
|
|
|
# https://cmake.org/cmake/help/latest/policy/CMP0087.html
|
|
|
|
cmake_policy(SET CMP0087 NEW)
|
2021-09-22 20:49:44 +02:00
|
|
|
get_property(_installed_utilities GLOBAL PROPERTY MAPNIK_UTILITIES)
|
|
|
|
get_property(_installed_targets GLOBAL PROPERTY TARGETS)
|
|
|
|
get_property(_installed_plugins GLOBAL PROPERTY PLUGINS)
|
|
|
|
set(_internal_executables "")
|
|
|
|
set(_internal_libraries "")
|
2021-04-10 14:36:22 +02:00
|
|
|
|
2021-09-22 20:49:44 +02:00
|
|
|
foreach(_target IN LISTS _installed_utilities)
|
|
|
|
list(APPEND _internal_executables "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
|
|
|
endforeach()
|
|
|
|
foreach(_target IN LISTS _installed_targets)
|
|
|
|
list(APPEND _internal_libraries "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
2021-04-10 14:36:22 +02:00
|
|
|
endforeach()
|
2021-09-22 20:49:44 +02:00
|
|
|
foreach(_target IN LISTS _installed_plugins)
|
|
|
|
list(APPEND _internal_libraries "${CMAKE_INSTALL_PREFIX}/${PLUGINS_INSTALL_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
2021-04-10 14:36:22 +02:00
|
|
|
endforeach()
|
|
|
|
# all other executables get auto detected and fixed.
|
2021-09-22 20:49:44 +02:00
|
|
|
if(_internal_executables)
|
|
|
|
list(GET _internal_executables 0 _internal_executables)
|
|
|
|
endif()
|
2021-04-10 14:36:22 +02:00
|
|
|
|
|
|
|
INSTALL(CODE "
|
2021-09-22 20:49:44 +02:00
|
|
|
message(STATUS \"${_internal_executables}\")
|
|
|
|
message(STATUS \"${_internal_libraries}\")
|
2021-04-10 14:36:22 +02:00
|
|
|
|
|
|
|
include(BundleUtilities)
|
2021-09-22 20:49:44 +02:00
|
|
|
fixup_bundle(\"${_internal_executables}\" \"${_internal_libraries}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
2021-09-22 14:41:50 +02:00
|
|
|
" COMPONENT MapnikRuntime)
|
2021-04-10 14:36:22 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
endfunction()
|