Fix issues with detecting Sphinx

develop
lethosor 2015-09-26 13:28:06 -04:00
parent 9c6611dfc3
commit 441afcced5
1 changed files with 23 additions and 22 deletions

@ -10,7 +10,7 @@ else(CMAKE_CONFIGURATION_TYPES)
endif (NOT CMAKE_BUILD_TYPE) endif (NOT CMAKE_BUILD_TYPE)
endif(CMAKE_CONFIGURATION_TYPES) endif(CMAKE_CONFIGURATION_TYPES)
SET(BUILD_DOCS "True" CACHE STRING "Choose whether to build the documentation (requires python and Sphinx.") SET(BUILD_DOCS ON CACHE BOOL "Choose whether to build the documentation (requires python and Sphinx).")
## some generic CMake magic ## some generic CMake magic
cmake_minimum_required(VERSION 2.8 FATAL_ERROR) cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
@ -194,29 +194,30 @@ endif()
add_subdirectory(scripts) add_subdirectory(scripts)
#find_package(Sphinx REQUIRED)
find_package(Sphinx) find_package(Sphinx)
if (BUILD_DOCS) if (BUILD_DOCS)
if (NOT SPHINX_FOUND)
set(SPHINX_THEME "alabaster") message(SEND_ERROR "Sphinx not found but BUILD_DOCS enabled")
set(SPHINX_THEME_DIR) endif()
set(SPHINX_BINARY_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/_build") set(SPHINX_THEME "alabaster")
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/_build/_doctrees") set(SPHINX_THEME_DIR)
set(SPHINX_HTML_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/") set(SPHINX_BINARY_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/_build")
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/_build/_doctrees")
configure_file( set(SPHINX_HTML_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/")
"${CMAKE_CURRENT_SOURCE_DIR}/docs/conf.py.in"
"${SPHINX_BINARY_BUILD_DIR}/conf.py" configure_file(
@ONLY) "${CMAKE_CURRENT_SOURCE_DIR}/docs/conf.py.in"
"${SPHINX_BINARY_BUILD_DIR}/conf.py"
add_custom_target(dfhack_docs ALL @ONLY)
${SPHINX_EXECUTABLE}
-q -b html add_custom_target(dfhack_docs ALL
-c "${SPHINX_BINARY_BUILD_DIR}" ${SPHINX_EXECUTABLE}
-d "${SPHINX_CACHE_DIR}" -q -b html
"${CMAKE_CURRENT_SOURCE_DIR}" -c "${SPHINX_BINARY_BUILD_DIR}"
"${SPHINX_HTML_DIR}" -d "${SPHINX_CACHE_DIR}"
COMMENT "Building HTML documentation with Sphinx") "${CMAKE_CURRENT_SOURCE_DIR}"
"${SPHINX_HTML_DIR}"
COMMENT "Building HTML documentation with Sphinx")
install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html
DESTINATION ${DFHACK_USERDOC_DESTINATION} DESTINATION ${DFHACK_USERDOC_DESTINATION}
#FILES_MATCHING PATTERN "*.lua" #FILES_MATCHING PATTERN "*.lua"