mirror of
https://github.com/Z3Prover/z3
synced 2025-08-08 04:01:22 +00:00
[CMake] Teach CMake to build the documentation for the API bindings
and install them. The target for building the documentation is `api_docs`. This is off by default but can be enabled with the `BUILD_DOCUMENTATION` option. The C and C++ API documentation is always built but the Python, ".NET", and Java documentation are only built if they are enabled in the build system. The rationale for this is that it would be confusing to install documentation for API bindings that are not installed. By default `ALWAYS_BUILD_DOCS` is on which will slow down builds significantly but will ensure that when the `install` target is invoked the documentation is up-to-date. Unfortunately I couldn't find a better way to do this. `ALWAYS_BUILD_DOCS` can be disabled to get faster builds and still have the `api_docs` target available.
This commit is contained in:
parent
a6a6a9c29f
commit
d4b7b489d0
3 changed files with 115 additions and 1 deletions
|
@ -43,10 +43,13 @@ message(STATUS "Z3 version ${Z3_VERSION}")
|
|||
# Set various useful variables depending on CMake version
|
||||
################################################################################
|
||||
if (("${CMAKE_VERSION}" VERSION_EQUAL "3.2") OR ("${CMAKE_VERSION}" VERSION_GREATER "3.2"))
|
||||
# In CMake >= 3.2 add_custom_command() supports a ``USES_TERMINAL`` argument
|
||||
# In CMake >= 3.2 add_custom_command() and add_custom_target()
|
||||
# supports a ``USES_TERMINAL`` argument
|
||||
set(ADD_CUSTOM_COMMAND_USES_TERMINAL_ARG "USES_TERMINAL")
|
||||
set(ADD_CUSTOM_TARGET_USES_TERMINAL_ARG "USES_TERMINAL")
|
||||
else()
|
||||
set(ADD_CUSTOM_COMMAND_USES_TERMINAL_ARG "")
|
||||
set(ADD_CUSTOM_TARGET_USES_TERMINAL_ARG "")
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
|
@ -528,3 +531,14 @@ option(ENABLE_EXAMPLE_TARGETS "Build Z3 api examples" ON)
|
|||
if (ENABLE_EXAMPLE_TARGETS)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Documentation
|
||||
################################################################################
|
||||
option(BUILD_DOCUMENTATION "Build API documentation" OFF)
|
||||
if (BUILD_DOCUMENTATION)
|
||||
message(STATUS "Building documentation enabled")
|
||||
add_subdirectory(doc)
|
||||
else()
|
||||
message(STATUS "Building documentation disabled")
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue