diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2018-12-02 05:55:59 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2018-12-02 22:00:38 +0000 |
commit | 8992760c68f3e508a0e5a25307c246a75f7c2ae2 (patch) | |
tree | ff099ba2de2c3e3b5477c3484c8c4ef07eb519d8 /help | |
parent | 67720f7fc325792b4ad16aeb0cab8a00b94262f4 (diff) |
CMake: Fix Windows help install target
We can't install from DATAFILE_DIR on this platform, we
must use CMAKE_BINARY_DIR.
Do that and try to keep this thing intact.
Ping-Bug: 15301
Change-Id: I5c0b787f8b1a148dda52f26242ab681e3c3a0d44
Reviewed-on: https://code.wireshark.org/review/30879
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'help')
-rw-r--r-- | help/CMakeLists.txt | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/help/CMakeLists.txt b/help/CMakeLists.txt new file mode 100644 index 0000000000..ddf1f068d2 --- /dev/null +++ b/help/CMakeLists.txt @@ -0,0 +1,71 @@ + +set(copy_help_files_depends) + +set(HELP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/toc) + +set(_textify_help_files + capture_filters.txt + capturing.txt + display_filters.txt + getting_started.txt + overview.txt +) + +foreach(_file ${_textify_help_files}) + if(WIN32) + list(APPEND HELP_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_file}) + else() + list(APPEND HELP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) + endif() +endforeach() + +list(APPEND HELP_FILES ${CMAKE_CURRENT_BINARY_DIR}/faq.txt) + +if(WIN32) + foreach(_help_file ${_textify_help_files}) + file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" _help_dest_dir) + add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_help_file}" + COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1" + -Destination "${_help_dest_dir}" + "${CMAKE_CURRENT_SOURCE_DIR}/${_help_file}" + DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/${_help_file}" + ) + endforeach() +endif() + +# Create help/faq.txt when missing +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/faq.txt" + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/faq.py -b > faq.tmp.html + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py + faq.tmp.html > "${CMAKE_CURRENT_BINARY_DIR}/faq.txt" + COMMAND ${CMAKE_COMMAND} -E remove faq.tmp.html + DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/faq.py" + "${CMAKE_SOURCE_DIR}/tools/html2text.py" +) + +foreach(_help_file ${HELP_FILES}) + get_filename_component(_name ${_help_file} NAME) + set(_src_file ${_help_file}) + set(_dst_file "${DATAFILE_DIR}/help/${_name}") + add_custom_command(OUTPUT "${_dst_file}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${_src_file}" + "${_dst_file}" + DEPENDS + "${_src_file}" + ) + list(APPEND copy_help_files_depends "${_dst_file}") +endforeach() + +if(WIN32) + set(HELP_FILES_DATADIR "help") +else() + set(HELP_FILES_DATADIR "${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}/help") +endif() + +add_custom_target(copy_help_files ALL DEPENDS ${copy_help_files_depends} ) +set_target_properties(copy_help_files PROPERTIES FOLDER "Copy Tasks") + +install(FILES ${HELP_FILES} DESTINATION ${HELP_FILES_DATADIR}) |