diff --git a/CMakeLists.txt b/CMakeLists.txt index f35d4c826..5bcaf2963 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,7 +356,7 @@ target_link_libraries(core INTERFACE ) target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS}) -mapnik_install(TARGET core) +mapnik_install(core) add_subdirectory(deps) add_subdirectory(src) diff --git a/cmake/MapnikInstall.cmake b/cmake/MapnikInstall.cmake index cb5d53700..fc5c4350e 100644 --- a/cmake/MapnikInstall.cmake +++ b/cmake/MapnikInstall.cmake @@ -1,44 +1,36 @@ -function(mapnik_install) - set(options ALREADY_INSTALLED IS_PLUGIN) - set(oneValueArgs TARGET) - set(multiValueArgs) - cmake_parse_arguments(MAPNIK_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) +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) + if (TARGET_TYPE STREQUAL "EXECUTABLE") + get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS) + list(APPEND MAPNIK_INSTALLED_TARGETS ${_target}) + set_property(GLOBAL PROPERTY TARGETS ${MAPNIK_INSTALLED_TARGETS}) + endif() +endfunction() - if(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND NOT MAPNIK_INSTALL_IS_PLUGIN) - install(TARGETS ${MAPNIK_INSTALL_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 - ) - elseif(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND MAPNIK_INSTALL_IS_PLUGIN) - install(TARGETS ${MAPNIK_INSTALL_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 - ) - endif() - 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() +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 + ) + get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS) + list(APPEND MAPNIK_INSTALLED_PLUGINS ${_target}) + set_property(GLOBAL PROPERTY PLUGINS ${MAPNIK_INSTALLED_PLUGINS}) endfunction() diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index 1b758fa2c..a50cd71c2 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -4,7 +4,7 @@ add_executable(mapnik-demo rundemo.cpp) target_link_libraries(mapnik-demo PRIVATE mapnik::agg mapnik::mapnik) -mapnik_install(TARGET mapnik-demo) +mapnik_install(mapnik-demo) mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape) mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts) mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 10ae37af7..9f64da28a 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -61,7 +61,7 @@ if(QT_VERSION_MAJOR EQUAL 6) endif() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin) -mapnik_install(TARGET mapnik-viewer) +mapnik_install(mapnik-viewer) mapnik_copy_dependencies( TARGETS diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index d289c2a3e..be5d0b11a 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -1,3 +1,6 @@ +set(_plugin_prefix "") +set(_plugin_suffix ".input") + if(USE_PLUGIN_INPUT_CSV) message(STATUS "using input plugin csv") add_subdirectory(csv) diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index 765ad98b5..636f5f147 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -7,15 +7,15 @@ add_library(input-csv MODULE csv_inline_featureset.cpp csv_utils.cpp ) -add_library(mapnik::plugin::input::csv ALIAS input-csv) - target_link_libraries(input-csv PRIVATE mapnik::mapnik mapnik::wkt mapnik::json ) -set_target_properties(input-csv PROPERTIES PREFIX "") -set_target_properties(input-csv PROPERTIES OUTPUT_NAME "csv") -set_target_properties(input-csv PROPERTIES SUFFIX ".input") +set_target_properties(input-csv PROPERTIES + OUTPUT_NAME "csv" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -mapnik_install(TARGET input-csv IS_PLUGIN) +mapnik_install_plugin(input-csv) diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index b07d16c75..6ae6336a4 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -6,15 +6,15 @@ add_library(input-gdal MODULE gdal_datasource.cpp gdal_featureset.cpp ) -add_library(mapnik::plugin::input::gdal ALIAS input-gdal) - target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIRS}) target_link_libraries(input-gdal PRIVATE mapnik::mapnik ${GDAL_LIBRARIES} ) -set_target_properties(input-gdal PROPERTIES PREFIX "") -set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal") -set_target_properties(input-gdal PROPERTIES SUFFIX ".input") +set_target_properties(input-gdal PROPERTIES + OUTPUT_NAME "gdal" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -mapnik_install(TARGET input-gdal IS_PLUGIN) +mapnik_install_plugin(input-gdal) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 47901ab7f..6406d528f 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -4,12 +4,11 @@ add_library(input-geobuf MODULE geobuf_datasource.cpp geobuf_featureset.cpp ) -add_library(mapnik::plugin::input::geobuf ALIAS input-geobuf) - target_link_libraries(input-geobuf PRIVATE mapnik::mapnik) +set_target_properties(input-geobuf PROPERTIES + OUTPUT_NAME "geobuf" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -set_target_properties(input-geobuf PROPERTIES PREFIX "") -set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf") -set_target_properties(input-geobuf PROPERTIES SUFFIX ".input") - -mapnik_install(TARGET input-geobuf IS_PLUGIN) +mapnik_install_plugin(input-geobuf) diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index 86f15474f..e04b7a768 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -6,15 +6,14 @@ add_library(input-geojson MODULE geojson_index_featureset.cpp geojson_memory_index_featureset.cpp ) -add_library(mapnik::plugin::input::geojson ALIAS input-geojson) - target_link_libraries(input-geojson PRIVATE mapnik::mapnik mapnik::json ) +set_target_properties(input-geojson PROPERTIES + OUTPUT_NAME "geojson" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -set_target_properties(input-geojson PROPERTIES PREFIX "") -set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson") -set_target_properties(input-geojson PROPERTIES SUFFIX ".input") - -mapnik_install(TARGET input-geojson IS_PLUGIN) +mapnik_install_plugin(input-geojson) diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index d8eface2a..b149bd893 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -8,15 +8,15 @@ add_library(input-ogr MODULE ogr_featureset.cpp ogr_index_featureset.cpp ) -add_library(mapnik::plugin::input::ogr ALIAS input-ogr) - target_include_directories(input-ogr PRIVATE ${GDAL_INCLUDE_DIRS}) target_link_libraries(input-ogr PRIVATE mapnik::mapnik ${GDAL_LIBRARIES} ) -set_target_properties(input-ogr PROPERTIES PREFIX "") -set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr") -set_target_properties(input-ogr PROPERTIES SUFFIX ".input") +set_target_properties(input-ogr PROPERTIES + OUTPUT_NAME "ogr" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -mapnik_install(TARGET input-ogr IS_PLUGIN) +mapnik_install_plugin(input-ogr) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index fed8f6a6c..7e6cb4dc7 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -7,15 +7,13 @@ add_library(input-pgraster MODULE pgraster_featureset.cpp pgraster_wkb_reader.cpp ) -add_library(mapnik::plugin::input::pgraster ALIAS input-pgraster) - - target_link_libraries(input-pgraster PRIVATE mapnik::mapnik PostgreSQL::PostgreSQL ) -set_target_properties(input-pgraster PROPERTIES PREFIX "") -set_target_properties(input-pgraster PROPERTIES OUTPUT_NAME "pgraster") -set_target_properties(input-pgraster PROPERTIES SUFFIX ".input") - -mapnik_install(TARGET input-pgraster IS_PLUGIN) +set_target_properties(input-pgraster PROPERTIES + OUTPUT_NAME "pgraster" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) +mapnik_install_plugin(input-pgraster) diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index b67cb5d30..667cfbd67 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -6,15 +6,14 @@ add_library(input-postgis MODULE postgis_datasource.cpp postgis_featureset.cpp ) -add_library(mapnik::plugin::input::postgis ALIAS input-postgis) - target_link_libraries(input-postgis PRIVATE mapnik::mapnik PostgreSQL::PostgreSQL ) +set_target_properties(input-postgis PROPERTIES + OUTPUT_NAME "postgis" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -set_target_properties(input-postgis PROPERTIES PREFIX "") -set_target_properties(input-postgis PROPERTIES OUTPUT_NAME "postgis") -set_target_properties(input-postgis PROPERTIES SUFFIX ".input") - -mapnik_install(TARGET input-postgis IS_PLUGIN) +mapnik_install_plugin(input-postgis) diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index a094fb67f..9b44540d3 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -5,12 +5,11 @@ add_library(input-raster MODULE raster_featureset.cpp raster_info.cpp ) -add_library(mapnik::plugin::input::raster ALIAS input-raster) - target_link_libraries(input-raster PRIVATE mapnik::mapnik) +set_target_properties(input-raster PROPERTIES + OUTPUT_NAME "raster" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -set_target_properties(input-raster PROPERTIES PREFIX "") -set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster") -set_target_properties(input-raster PROPERTIES SUFFIX ".input") - -mapnik_install(TARGET input-raster IS_PLUGIN) +mapnik_install_plugin(input-raster) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index cd1694cf4..1db71db7b 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -8,12 +8,11 @@ add_library(input-shape MODULE shape_index_featureset.cpp shape_io.cpp shape_utils.cpp ) -add_library(mapnik::plugin::input::shape ALIAS input-shape) - target_link_libraries(input-shape PRIVATE mapnik::mapnik) +set_target_properties(input-shape PROPERTIES + OUTPUT_NAME "shape" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -set_target_properties(input-shape PROPERTIES PREFIX "") -set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape") -set_target_properties(input-shape PROPERTIES SUFFIX ".input") - -mapnik_install(TARGET input-shape IS_PLUGIN) +mapnik_install_plugin(input-shape) diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index 9df08bf26..dedf98c3a 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -7,14 +7,14 @@ add_library(input-sqlite MODULE sqlite_featureset.cpp ) add_library(mapnik::plugin::input::sqlite ALIAS input-sqlite) - target_link_libraries(input-sqlite PRIVATE mapnik::mapnik SQLite::SQLite3 ) +set_target_properties(input-sqlite PROPERTIES + OUTPUT_NAME "sqlite" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -set_target_properties(input-sqlite PROPERTIES PREFIX "") -set_target_properties(input-sqlite PROPERTIES OUTPUT_NAME "sqlite") -set_target_properties(input-sqlite PROPERTIES SUFFIX ".input") - -mapnik_install(TARGET input-sqlite IS_PLUGIN) +mapnik_install_plugin(input-sqlite) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index 9ba6f5ded..bd6f2cc67 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -5,14 +5,14 @@ add_library(input-topojson MODULE topojson_featureset.cpp ) add_library(mapnik::plugin::input::topojson ALIAS input-topojson) - target_link_libraries(input-topojson PRIVATE mapnik::mapnik mapnik::json ) +set_target_properties(input-topojson PROPERTIES + OUTPUT_NAME "topojson" + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" +) -set_target_properties(input-topojson PROPERTIES PREFIX "") -set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson") -set_target_properties(input-topojson PROPERTIES SUFFIX ".input") - -mapnik_install(TARGET input-topojson IS_PLUGIN) +mapnik_install_plugin(input-topojson) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c2c70f8da..e163aaf34 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -303,4 +303,4 @@ if(MSVC) target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910") endif() -mapnik_install(TARGET mapnik) +mapnik_install(mapnik) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index d43e0660c..1b9d8bc23 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -31,4 +31,4 @@ set_target_properties(json PROPERTIES PREFIX "libmapnik-" ) -mapnik_install(TARGET json) +mapnik_install(json) diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index e2e2eafbb..c0033bb98 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -23,4 +23,4 @@ set_target_properties(wkt PROPERTIES PREFIX "libmapnik-" ) -mapnik_install(TARGET wkt) +mapnik_install(wkt) diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index bce4af989..365bb89f7 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -4,4 +4,4 @@ add_executable(geometry_to_wkb main.cpp) target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik) -mapnik_install(TARGET geometry_to_wkb) +mapnik_install(geometry_to_wkb) diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index f9e568474..de5dc7d68 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -15,4 +15,4 @@ target_link_libraries(mapnik-index PRIVATE Boost::program_options ) -mapnik_install(TARGET mapnik-index) +mapnik_install(mapnik-index) diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 705482350..f655a6fd3 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -9,4 +9,4 @@ target_link_libraries(mapnik-render PRIVATE Boost::program_options ) -mapnik_install(TARGET mapnik-render) +mapnik_install(mapnik-render) diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index 46b9cf0eb..9b2b4df2a 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -4,4 +4,4 @@ add_executable(ogrindex ogrindex.cpp) target_link_libraries(ogrindex PRIVATE mapnik::mapnik) -mapnik_install(TARGET ogrindex) +mapnik_install(ogrindex) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 1412e4dd6..c60e5d597 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -16,4 +16,4 @@ target_link_libraries(pgsql2sqlite PRIVATE mapnik::mapnik ) -mapnik_install(TARGET pgsql2sqlite) +mapnik_install(pgsql2sqlite) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index c3ddb9208..e7d2bd9ad 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -12,4 +12,4 @@ target_link_libraries(shapeindex PRIVATE mapnik::mapnik ) -mapnik_install(TARGET shapeindex) +mapnik_install(shapeindex) diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index 7dce53fbe..76bc72d77 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -12,4 +12,4 @@ target_link_libraries(svg2png PRIVATE mapnik::agg ) -mapnik_install(TARGET svg2png) +mapnik_install(svg2png)