diff --git a/CMakeLists.txt b/CMakeLists.txt index 239a96938f..22d1e8623e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1415,11 +1415,6 @@ foreach(_plugin_src_dir ${PLUGIN_SRC_DIRS}) add_subdirectory( ${_plugin_src_dir} ) endforeach() - -# Basedir where to install guides -set(DOC_DIR "$ENV{docdir}" CACHE FILEPATH "Installation directory for ug and dg pdfs.") -message(STATUS "docdir: ${DOC_DIR}") - if(ENABLE_PCAP_NG_DEFAULT) set(PCAP_NG_DEFAULT 1) endif() @@ -3049,6 +3044,10 @@ set_source_files_properties( install( FILES ${INSTALL_FILES} + PERMISSIONS + OWNER_WRITE OWNER_READ + GROUP_READ + WORLD_READ DESTINATION ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME} ) @@ -3113,12 +3112,16 @@ install( install( DIRECTORY ${INSTALL_DIRS} + DESTINATION + ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME} + FILE_PERMISSIONS + OWNER_WRITE OWNER_READ + GROUP_READ + WORLD_READ DIRECTORY_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ - DESTINATION - ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME} PATTERN ".git" EXCLUDE PATTERN ".svn" EXCLUDE PATTERN "Makefile.*" EXCLUDE @@ -3141,22 +3144,6 @@ install( ${CMAKE_INSTALL_MODULES_DIR} ) -if(DOC_DIR) - message(STATUS "Docdir install: ${DOC_DIR}") - INSTALL( - DIRECTORY - ${CMAKE_BINARY_DIR}/docbook/ - DIRECTORY_PERMISSIONS - OWNER_EXECUTE OWNER_WRITE OWNER_READ - GROUP_EXECUTE GROUP_READ - WORLD_EXECUTE WORLD_READ - DESTINATION - ${DOC_DIR}/guides - FILES_MATCHING - PATTERN "*.pdf" - ) -endif() - # Test suite wrapper if(ENABLE_APPLICATION_BUNDLE) set(TEST_SH_BIN_DIR ${CMAKE_BINARY_DIR}/run) diff --git a/cmake/modules/FileInstall.cmake b/cmake/modules/FileInstall.cmake new file mode 100644 index 0000000000..3358aa2a80 --- /dev/null +++ b/cmake/modules/FileInstall.cmake @@ -0,0 +1,33 @@ +# FileInstall - Install files and directories separately from the +# "install" command. +# +# Usage: +# cmake -P /path/to/FileInstall.cmake [source ...] [destination] + +# Params are +# cmake -P /path/to/hhc.cmake "/path/to/hhc.exe" project.hhp +math(EXPR _dest_idx "${CMAKE_ARGC} - 1") +set(_destination ${CMAKE_ARGV${_dest_idx}}) +set(_sources) + +math(EXPR _last_src "${CMAKE_ARGC} - 2") +foreach(_src_idx RANGE 3 ${_last_src}) + set(_sources ${_sources} ${CMAKE_ARGV${_src_idx}}) +endforeach(_src_idx) + +if (_sources AND _destination) + message (STATUS "Installing ${_sources} to ${_destination}") + file (INSTALL ${_sources} + DESTINATION ${_destination} + FILE_PERMISSIONS + OWNER_WRITE OWNER_READ + GROUP_READ + WORLD_READ + DIRECTORY_PERMISSIONS + OWNER_EXECUTE OWNER_WRITE OWNER_READ + GROUP_EXECUTE GROUP_READ + WORLD_EXECUTE WORLD_READ + ) +else() + message (FATAL_ERROR "Missing arguments. Sources: ${_sources}. Destination: ${_destination}.") +endif() diff --git a/docbook/CMakeLists.txt b/docbook/CMakeLists.txt index 56d0fa0268..cfdeb25a2c 100644 --- a/docbook/CMakeLists.txt +++ b/docbook/CMakeLists.txt @@ -78,6 +78,7 @@ set(WSUG_TOOLS_HELP_COMMANDS # being able to build our documentation. set(WSUG_TOOLS_HELP_FILES) set(WSUG_TOOLS_PHONY_DEPS) +set(GUIDE_INSTALL_DIRS) # General help output foreach(th_command ${WSUG_TOOLS_HELP_COMMANDS}) @@ -424,6 +425,7 @@ if(ASCIIDOCTOR_EXECUTABLE AND XSLTPROC_EXECUTABLE) ) set_docbook_target_properties(user_guide_html) add_dependencies(user_guides user_guide_html) + list(APPEND GUIDE_INSTALL_DIRS ${CMAKE_CURRENT_BINARY_DIR}/wsug_html_chunked) endif() if(ASCIIDOCTOR_EXECUTABLE) @@ -475,6 +477,7 @@ if(ASCIIDOCTOR_EXECUTABLE AND XSLTPROC_EXECUTABLE) ) set_docbook_target_properties(developer_guide_html) add_dependencies(developer_guides developer_guide_html) + list(APPEND GUIDE_INSTALL_DIRS ${CMAKE_CURRENT_BINARY_DIR}/wsdg_html_chunked) endif() if(ASCIIDOCTOR_EXECUTABLE) @@ -501,6 +504,20 @@ if(WIN32 AND ASCIIDOCTOR_EXECUTABLE) add_dependencies(developer_guides developer_guide_chm) endif() +if (GUIDE_INSTALL_DIRS) + # The installation location and DOC_DIR in ui/help_url.c must + # match. + add_custom_target(install_guides + COMMAND ${CMAKE_COMMAND} -P + ${CMAKE_SOURCE_DIR}/cmake/modules/FileInstall.cmake + ${GUIDE_INSTALL_DIRS} + ${CMAKE_INSTALL_FULL_DOCDIR} + DEPENDS + user_guide_html developer_guide_html + ) + set_docbook_target_properties(install_guides) +endif() + # release_notes: release-notes.html release-notes.txt add_custom_target( release_notes_html DEPENDS release-notes.html ) diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index f5ed7b199c..ea78f7830c 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -107,6 +107,8 @@ if (HTML_HELP_COMPILER) target_link_libraries(ui Htmlhelp.lib) endif() +add_definitions(-DDOC_DIR="${CMAKE_INSTALL_FULL_DOCDIR}") + CHECKAPI( NAME ui-base diff --git a/ui/Makefile.am b/ui/Makefile.am index e3b468c700..c273d59aad 100644 --- a/ui/Makefile.am +++ b/ui/Makefile.am @@ -22,6 +22,7 @@ include $(top_srcdir)/Makefile.am.inc +# The installation location and DOC_DIR in ui/help_url.c must match. AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) -DDOC_DIR=\"$(docdir)\" \ $(GLIB_CFLAGS) $(PCAP_CFLAGS) $(LIBGCRYPT_CFLAGS) $(LIBGNUTLS_CFLAGS) $(PORTAUDIO_INCLUDES)