File: GenerateHelptags.cmake.in

package info (click to toggle)
neovim 0.1.7-4%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 39,060 kB
  • sloc: ansic: 176,052; python: 2,091; awk: 709; sh: 528; perl: 374; makefile: 295; exp: 33; ruby: 8
file content (39 lines) | stat: -rw-r--r-- 1,361 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
if(DEFINED ENV{DESTDIR})
  file(TO_CMAKE_PATH
    $ENV{DESTDIR}/@CMAKE_INSTALL_FULL_DATADIR@/nvim/runtime/doc
    HELPTAGS_WORKING_DIRECTORY)
else()
  file(TO_CMAKE_PATH
    @CMAKE_INSTALL_FULL_DATADIR@/nvim/runtime/doc
    HELPTAGS_WORKING_DIRECTORY)
endif()

message(STATUS "Generating helptags in ${HELPTAGS_WORKING_DIRECTORY}.")
if(EXISTS ${HELPTAGS_WORKING_DIRECTORY}/)
  message(STATUS "${HELPTAGS_WORKING_DIRECTORY} already exists")
  # If the doc directory already exists, helptags could fail due to duplicate
  # tags. Tell the user to remove the directory and try again.
  set(TROUBLESHOOTING "\nRemove \"${HELPTAGS_WORKING_DIRECTORY}\" and try again.")
endif()

# Workaround for hanging "yes | nvim -c 'helptags ++t .'"
# and therefore hanging "yes | make install":
# Set INPUT_FILE to an empty file, causing execute_process
# to disregard other standard input (such as "yes |").
set(EMPTY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.GenerateHelptags)
file(WRITE ${EMPTY_FILE} "")
execute_process(
  COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/nvim
    -u NONE
    -es
    -c "helptags ++t ."
    -c quit
  WORKING_DIRECTORY ${HELPTAGS_WORKING_DIRECTORY}
  INPUT_FILE ${EMPTY_FILE}
  OUTPUT_VARIABLE err
  ERROR_VARIABLE err
  RESULT_VARIABLE res)

if(NOT res EQUAL 0)
  message(FATAL_ERROR "Generating helptags failed: ${err} - ${res}${TROUBLESHOOTING}")
endif()