diff --git a/CMakeLists.txt b/CMakeLists.txt index a01e05b49..3e6bda855 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(MapnikFindPackage) include(MapnikCopyDependencies) -set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully") -option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (currently only windows) to the executable directory" ON) +set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully") +option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" ON) +option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON) option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) option(BUILD_TEST "builds the tests" ON) diff --git a/cmake/MapnikCopyDependencies.cmake b/cmake/MapnikCopyDependencies.cmake index 11736c7e4..4d14174a7 100644 --- a/cmake/MapnikCopyDependencies.cmake +++ b/cmake/MapnikCopyDependencies.cmake @@ -28,31 +28,34 @@ function(mapnik_copy_dependencies) endfunction() function(mapnik_copy_plugins) - set(options) - set(oneValueArgs TARGET DESTINATION) - set(multiValueArgs PLUGINS) - cmake_parse_arguments(MAPNIK_CP_PLG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - # copy_if_different requires a existing directory. - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}) - foreach(PLUGIN IN LISTS MAPNIK_CP_PLG_PLUGINS) - #message(STATUS "copying plugin ${PLUGIN} to path: ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}") - if(TARGET ${PLUGIN}) - add_custom_command(TARGET ${MAPNIK_CP_PLG_TARGET} POST_BUILD COMMAND - ${CMAKE_COMMAND} -E copy_if_different "$" ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}/) - else() - message(NOTICE "${MAPNIK_CP_PLG_TARGET} requires plugin ${PLUGIN} but it isn't build. Check USE_PLUGIN_INPUT_ options to enable the plugin.") - endif() - endforeach() + if(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES) + set(options) + set(oneValueArgs TARGET DESTINATION) + set(multiValueArgs PLUGINS) + cmake_parse_arguments(MAPNIK_CP_PLG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + # copy_if_different requires a existing directory. + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}) + foreach(PLUGIN IN LISTS MAPNIK_CP_PLG_PLUGINS) + #message(STATUS "copying plugin ${PLUGIN} to path: ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}") + if(TARGET ${PLUGIN}) + add_custom_command(TARGET ${MAPNIK_CP_PLG_TARGET} POST_BUILD COMMAND + ${CMAKE_COMMAND} -E copy_if_different "$" ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}/) + else() + message(NOTICE "${MAPNIK_CP_PLG_TARGET} requires plugin ${PLUGIN} but it isn't build. Check USE_PLUGIN_INPUT_ options to enable the plugin.") + endif() + endforeach() + endif() endfunction() function(mapnik_require_fonts) - set(options) - set(oneValueArgs TARGET DESTINATION) - set(multiValueArgs) - cmake_parse_arguments(MAPNIK_REQUIRE_FONTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES) + set(options) + set(oneValueArgs TARGET DESTINATION) + set(multiValueArgs) + cmake_parse_arguments(MAPNIK_REQUIRE_FONTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - add_custom_command(TARGET ${MAPNIK_REQUIRE_FONTS_TARGET} POST_BUILD COMMAND - ${CMAKE_COMMAND} -E copy_directory ${mapnik_SOURCE_DIR}/fonts ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_REQUIRE_FONTS_DESTINATION}/) + add_custom_command(TARGET ${MAPNIK_REQUIRE_FONTS_TARGET} POST_BUILD COMMAND + ${CMAKE_COMMAND} -E copy_directory ${mapnik_SOURCE_DIR}/fonts ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_REQUIRE_FONTS_DESTINATION}/) + endif() endfunction()