mirror of https://github.com/fltk/fltk
CMake: Fix some special cases regarding generation of docs
Ignore error if docs are not generated using a git working tree, for instance from a downloaded tarball or zip file. This is only a temporary solution for issue #499 (see "FIXME" comment). Execute doxygen only if it is available. i.e. found by CMake.
This commit is contained in:
parent
30efed7fd4
commit
5646522985
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
set (DOCS)
|
set (DOCS)
|
||||||
set (GENERATE_DOCS FALSE)
|
set (GENERATE_DOCS FALSE)
|
||||||
|
set (GIT_REVISION "")
|
||||||
|
set (YEAR "")
|
||||||
|
set (CURRENT_DATE "")
|
||||||
|
|
||||||
if (OPTION_BUILD_HTML_DOCUMENTATION OR OPTION_BUILD_PDF_DOCUMENTATION)
|
if (OPTION_BUILD_HTML_DOCUMENTATION OR OPTION_BUILD_PDF_DOCUMENTATION)
|
||||||
set (GENERATE_DOCS TRUE)
|
set (GENERATE_DOCS TRUE)
|
||||||
|
@ -44,24 +47,33 @@ if (GENERATE_DOCS)
|
||||||
OUTPUT_VARIABLE CURRENT_DATE
|
OUTPUT_VARIABLE CURRENT_DATE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# find git revision
|
||||||
|
|
||||||
|
# FIXME: This must also work with tarballs where git is not available.
|
||||||
|
# For now we just ignore errors and set GIT_REVISION = "unkown".
|
||||||
|
# In the future tarball/zip generation should create a file
|
||||||
|
# that contains the git revision.
|
||||||
|
|
||||||
execute_process (COMMAND
|
execute_process (COMMAND
|
||||||
git --git-dir=${CMAKE_SOURCE_DIR}/.git rev-parse --short=10 HEAD
|
git --git-dir=${CMAKE_SOURCE_DIR}/.git rev-parse --short=10 HEAD
|
||||||
OUTPUT_VARIABLE GIT_REVISION
|
OUTPUT_VARIABLE GIT_REVISION
|
||||||
|
ERROR_QUIET
|
||||||
)
|
)
|
||||||
|
# strip trailing newline from git revision
|
||||||
|
string (REPLACE "\n" "" GIT_REVISION "${GIT_REVISION}")
|
||||||
|
# set to "'unkown'" if git is not available
|
||||||
|
if (GIT_REVISION STREQUAL "")
|
||||||
|
set (GIT_REVISION "'unkown'")
|
||||||
|
endif()
|
||||||
|
|
||||||
# strip trailing newline
|
# find doxygen version
|
||||||
string (REPLACE "\n" "" GIT_REVISION ${GIT_REVISION})
|
|
||||||
|
|
||||||
execute_process (COMMAND doxygen --version
|
if (DOXYGEN_FOUND)
|
||||||
OUTPUT_VARIABLE DOXYGEN_VERSION_SHORT
|
# strip trailing git revision if doxygen was built from source
|
||||||
)
|
string (REGEX REPLACE " .*$" "" DOXYGEN_VERSION_SHORT ${DOXYGEN_VERSION})
|
||||||
|
# strip trailing newline
|
||||||
# strip trailing git revision if doxygen was built from source
|
string (REPLACE "\n" "" DOXYGEN_VERSION_SHORT "${DOXYGEN_VERSION_SHORT}")
|
||||||
string (REGEX REPLACE " .*$" "" DOXYGEN_VERSION_SHORT ${DOXYGEN_VERSION_SHORT})
|
endif (DOXYGEN_FOUND)
|
||||||
|
|
||||||
## fl_debug_var (GIT_REVISION)
|
|
||||||
## fl_debug_var (DOXYGEN_EXECUTABLE)
|
|
||||||
## fl_debug_var (DOXYGEN_VERSION_SHORT)
|
|
||||||
|
|
||||||
# configure copyright.dox (includes current year)
|
# configure copyright.dox (includes current year)
|
||||||
configure_file (
|
configure_file (
|
||||||
|
@ -77,6 +89,14 @@ if (GENERATE_DOCS)
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (0) # debug
|
||||||
|
fl_debug_var (GIT_REVISION)
|
||||||
|
fl_debug_var (DOXYGEN_FOUND)
|
||||||
|
fl_debug_var (DOXYGEN_EXECUTABLE)
|
||||||
|
fl_debug_var (DOXYGEN_VERSION)
|
||||||
|
fl_debug_var (DOXYGEN_VERSION_SHORT)
|
||||||
|
endif ()
|
||||||
|
|
||||||
endif (GENERATE_DOCS)
|
endif (GENERATE_DOCS)
|
||||||
|
|
||||||
#--------------------------
|
#--------------------------
|
||||||
|
|
Loading…
Reference in New Issue