2021-04-10 14:36:22 +02:00
|
|
|
function(mapnik_install)
|
|
|
|
set(options ALREADY_INSTALLED IS_PLUGIN)
|
|
|
|
set(oneValueArgs TARGET)
|
|
|
|
set(multiValueArgs)
|
|
|
|
cmake_parse_arguments(MAPNIK_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
|
2021-07-23 16:04:25 +02:00
|
|
|
if(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND NOT MAPNIK_INSTALL_IS_PLUGIN)
|
2021-04-10 14:36:22 +02:00
|
|
|
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
|
|
|
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
|
|
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
|
|
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
|
|
)
|
2021-07-23 16:04:25 +02:00
|
|
|
elseif(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND MAPNIK_INSTALL_IS_PLUGIN)
|
2021-04-10 14:36:22 +02:00
|
|
|
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
2021-04-22 19:41:21 +02:00
|
|
|
LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR}
|
|
|
|
ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR}
|
2021-04-10 14:36:22 +02:00
|
|
|
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
2021-07-23 16:04:25 +02:00
|
|
|
if(NOT MAPNIK_INSTALL_IS_PLUGIN)
|
2021-04-10 14:36:22 +02:00
|
|
|
message(STATUS "${MAPNIK_INSTALL_TARGET}")
|
|
|
|
get_target_property(TARGET_TYPE "${MAPNIK_INSTALL_TARGET}" TYPE)
|
|
|
|
if (TARGET_TYPE STREQUAL "EXECUTABLE")
|
|
|
|
get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS)
|
|
|
|
list(APPEND MAPNIK_INSTALLED_TARGETS ${MAPNIK_INSTALL_TARGET})
|
|
|
|
set_property(GLOBAL PROPERTY TARGETS ${MAPNIK_INSTALLED_TARGETS})
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS)
|
|
|
|
list(APPEND MAPNIK_INSTALLED_PLUGINS ${MAPNIK_INSTALL_TARGET})
|
|
|
|
set_property(GLOBAL PROPERTY PLUGINS ${MAPNIK_INSTALLED_PLUGINS})
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS)
|
|
|
|
get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS)
|
|
|
|
set(INTERNAL_TARGETS "")
|
|
|
|
set(INTERNAL_PLUGINS "")
|
|
|
|
|
|
|
|
foreach(_target IN LISTS MAPNIK_INSTALLED_TARGETS)
|
|
|
|
list(APPEND INTERNAL_TARGETS "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
|
|
|
endforeach()
|
|
|
|
foreach(_target IN LISTS MAPNIK_INSTALLED_PLUGINS)
|
|
|
|
list(APPEND INTERNAL_PLUGINS "${CMAKE_INSTALL_PREFIX}/${PLUGINS_INSTALL_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
|
|
|
endforeach()
|
|
|
|
# all other executables get auto detected and fixed.
|
|
|
|
list(GET INTERNAL_TARGETS 0 INTERNAL_TARGETS)
|
|
|
|
|
|
|
|
INSTALL(CODE "
|
|
|
|
message(STATUS \"${INTERNAL_TARGETS}\")
|
|
|
|
message(STATUS \"${INTERNAL_PLUGINS}\")
|
|
|
|
|
|
|
|
include(BundleUtilities)
|
|
|
|
fixup_bundle(\"${INTERNAL_TARGETS}\" \"${INTERNAL_PLUGINS}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
|
|
|
" COMPONENT Runtime)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endfunction()
|