mapnik/cmake/MapnikInstall.cmake

63 lines
2.7 KiB
CMake
Raw Normal View History

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)
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)
install(TARGETS ${MAPNIK_INSTALL_TARGET}
LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR}
ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR}
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
)
endif()
2021-07-23 16:04:25 +02:00
if(NOT MAPNIK_INSTALL_IS_PLUGIN)
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)
if(INSTALL_DEPENDENCIES AND WIN32)
# 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()