summaryrefslogtreecommitdiffstats
path: root/docs/CMakeLists.txt
blob: 63dd582db54c82e609f4ae556d83a54d9afcad4d (plain)
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
find_program(SPHINX sphinx-build PATHS /usr/local/bin /usr/bin)
mark_as_advanced(SPHINX)

# --- End-user manual ---------------------------------------------------------
if(SPHINX)
    option(WITH_MANUAL "Build user manual" ON)

    if (WITH_MANUAL)
        set(input_dir ${CMAKE_CURRENT_SOURCE_DIR})
        set(output_dir ${CMAKE_CURRENT_BINARY_DIR}/manual/html)

        file(GLOB_RECURSE sphinx_source ${input_dir}/*.rst)
        
        foreach(file ${sphinx_static})
            configure_file(${input_dir}/${file} ${output_dir}/${file} COPYONLY)
        endforeach()

        add_custom_command(OUTPUT ${output_dir}/index.html
            COMMAND ${SPHINX} -b html ${input_dir} ${output_dir}
            DEPENDS ${sphinx_source}
            COMMENT "Build Sphinx HTML")

        add_custom_target(manual ALL DEPENDS ${output_dir}/index.html)

        add_dependencies(manual ufo)
    endif()
endif()