aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-05-21 14:32:35 -0700
committerAnders Broman <a.broman58@gmail.com>2018-05-22 07:34:57 +0000
commiteed49613872b0f2ab52c52048b74bf50c6e2e212 (patch)
tree94dd3e3afdbe8c1770c4391063bd3ed224ddd9d5 /cmake/modules
parent50197b30236f1b5b3e7ee8a90c57a3dbcbd835e5 (diff)
CMake: Search for asciidoctor-pdf separate from asciidoctor.
Search for asciidoctorj and asciidoctor-pdf and set ASCIIDOCTOR_PDF_EXECUTABLE if either are found. Only enable the PDF targets if we find ASCIIDOCTOR_PDF_EXECUTABLE. Remove env.cmake since it's no longer needed. Change-Id: Iee82b30eaa67d1ad3fd3a296d9997b0643a0cb4e Reviewed-on: https://code.wireshark.org/review/27696 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/FindAsciidoctor.cmake71
1 files changed, 46 insertions, 25 deletions
diff --git a/cmake/modules/FindAsciidoctor.cmake b/cmake/modules/FindAsciidoctor.cmake
index f6328876d3..cdbb351311 100644
--- a/cmake/modules/FindAsciidoctor.cmake
+++ b/cmake/modules/FindAsciidoctor.cmake
@@ -19,6 +19,18 @@ FIND_PROGRAM(ASCIIDOCTOR_EXECUTABLE
DOC "Path to Asciidoctor or AsciidoctorJ"
)
+FIND_PROGRAM(ASCIIDOCTOR_PDF_EXECUTABLE
+ NAMES
+ asciidoctorj
+ asciidoctor-pdf
+ PATHS
+ /bin
+ /usr/bin
+ /usr/local/bin
+ ${CHOCOLATEY_BIN_PATH}
+ DOC "Path to Asciidoctor or AsciidoctorJ"
+)
+
if(ASCIIDOCTOR_EXECUTABLE)
# The AsciidctorJ wrapper script sets -Xmx256m. This isn't enough
# for the User's Guide.
@@ -42,14 +54,8 @@ if(ASCIIDOCTOR_EXECUTABLE)
--require ${CMAKE_CURRENT_SOURCE_DIR}/asciidoctor-macros/ws_salink-inline-macro.rb
)
- if(CMAKE_VERSION VERSION_LESS 3.1)
- set(_env_command ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/env.cmake)
- else()
- set(_env_command ${CMAKE_COMMAND} -E env)
- endif()
-
- set(_asciidoctor_common_command ${_env_command}
- TZ=UTC ASCIIDOCTORJ_OPTS="${_asciidoctorj_opts}"
+ set(_asciidoctor_common_command
+ ${CMAKE_COMMAND} -E env TZ=UTC ASCIIDOCTORJ_OPTS="${_asciidoctorj_opts}"
${ASCIIDOCTOR_EXECUTABLE}
${_asciidoctor_common_args}
)
@@ -118,26 +124,41 @@ if(ASCIIDOCTOR_EXECUTABLE)
# news: release-notes.txt
# ${CMAKE_COMMAND} -E copy_if_different release-notes.txt ../NEWS
- MACRO( ASCIIDOCTOR2PDF _asciidocsource )
- GET_FILENAME_COMPONENT( _source_base_name ${_asciidocsource} NAME_WE )
- set( _output_pdf ${_source_base_name}.pdf )
+ if(ASCIIDOCTOR_PDF_EXECUTABLE)
- ADD_CUSTOM_COMMAND(
+ set(_asciidoctor_pdf_common_command
+ ${CMAKE_COMMAND} -E env TZ=UTC ASCIIDOCTORJ_OPTS="${_asciidoctorj_opts}"
+ ${ASCIIDOCTOR_PDF_EXECUTABLE}
+ --require asciidoctor-pdf
+ --backend pdf
+ ${_asciidoctor_common_args}
+ )
+
+ MACRO( ASCIIDOCTOR2PDF _asciidocsource )
+ GET_FILENAME_COMPONENT( _source_base_name ${_asciidocsource} NAME_WE )
+ set( _output_pdf ${_source_base_name}.pdf )
+
+ ADD_CUSTOM_COMMAND(
OUTPUT
- ${_output_pdf}
- COMMAND ${_asciidoctor_common_command}
- --backend pdf
- ${_asciidoctor_common_args}
- --out-file ${_output_pdf}
- ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
+ ${_output_pdf}
+ COMMAND ${_asciidoctor_pdf_common_command}
+ --out-file ${_output_pdf}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
DEPENDS
- ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
- ${ARGN}
- )
- add_custom_target(generate_${_output_pdf} DEPENDS ${_output_pdf})
- set_asciidoctor_target_properties(generate_${_output_pdf})
- unset(_output_pdf)
- ENDMACRO()
+ ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
+ ${ARGN}
+ )
+ add_custom_target(generate_${_output_pdf} DEPENDS ${_output_pdf})
+ set_asciidoctor_target_properties(generate_${_output_pdf})
+ unset(_output_pdf)
+ ENDMACRO()
+
+ else(ASCIIDOCTOR_PDF_EXECUTABLE)
+
+ MACRO( ASCIIDOCTOR2PDF _asciidocsource )
+ ENDMACRO()
+
+ endif(ASCIIDOCTOR_PDF_EXECUTABLE)
endif(ASCIIDOCTOR_EXECUTABLE)