]> sigrok.org Git - pulseview.git/blobdiff - manual/CMakeLists.txt
Session: Fix issue #67 by improving error handling
[pulseview.git] / manual / CMakeLists.txt
index c425f36b3bdd7eb3cf246b6c593a97218a8edcfd..3b881a56d6f3e61216742750a3bdcc48feb294fe 100644 (file)
@@ -19,6 +19,8 @@
 
 cmake_minimum_required(VERSION 2.8.12)
 
+project(PV_MANUAL)
+
 # External dependencies, required and optional tools.
 find_program(ASCIIDOCTOR_EXECUTABLE NAMES asciidoctor)
 find_program(ASCIIDOCTOR_PDF_EXECUTABLE NAMES asciidoctor-pdf)
@@ -34,6 +36,22 @@ set(MANUAL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/manual.txt")
 set(MANUAL_OUT_HTML "${CMAKE_CURRENT_BINARY_DIR}/manual.html")
 set(MANUAL_OUT_PDF "${CMAKE_CURRENT_BINARY_DIR}/manual.pdf")
 
+# Make in-source images/ content available to the output hierarchy for
+# the inspection of created output documents during development in the
+# case of out-of-source build configurations.
+if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/images")
+       message(STATUS "creating symlink for manual's images/ subdirectory")
+       execute_process(
+               COMMAND ${CMAKE_COMMAND} -E create_symlink
+                       "${CMAKE_CURRENT_SOURCE_DIR}/images"
+                       "${CMAKE_CURRENT_BINARY_DIR}/images"
+               RESULT_VARIABLE IMAGES_LINK_RESULT
+       )
+       if (NOT IMAGES_LINK_RESULT EQUAL 0)
+               message(WARNING "manual rendering will lack images")
+       endif ()
+endif ()
+
 # Manual related make(1) targets.
 add_custom_target(manual-html
        COMMAND ${ASCIIDOCTOR_EXECUTABLE}
@@ -57,7 +75,7 @@ if (ASCIIDOCTOR_PDF_EXECUTABLE)
                BYPRODUCTS ${MANUAL_OUT_PDF}
                DEPENDS ${MANUAL_SRC}
                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-               COMMENT "Generating manual, HTML output"
+               COMMENT "Generating manual, PDF output"
        )
 else ()
        add_custom_target(manual-pdf