Skip to content

Commit

Permalink
include optional sphinx dependency in cmake build
Browse files Browse the repository at this point in the history
  • Loading branch information
karlnapf authored and vigsterkr committed Mar 10, 2016
1 parent 1e41e0e commit 301af0f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Expand Up @@ -636,6 +636,13 @@ IF(NOT ENABLE_META_EXAMPLES)
SET(ENABLE_COOKBOOK 0)
ENDIF()

find_package(Sphinx)
IF(NOT SPHINX_FOUND)
message("-- Sphinx is required for building cookbook. Disabling.")
SET(ENABLE_COOKBOOK 0)
ENDIF()


FIND_PACKAGE(LpSolve)
IF (LPSOLVE_FOUND)
SET(USE_LPSOLVE 1)
Expand Down
24 changes: 24 additions & 0 deletions cmake/FindSphinx.cmake
@@ -0,0 +1,24 @@
# Talen from https://llvm.org/svn/llvm-project/llvm/trunk/cmake/modules/FindSphinx.cmake
# under "UIUC" BSD-Style license.
# CMake find_package() Module for Sphinx documentation generator
# http://sphinx-doc.org/
#
# Example usage:
#
# find_package(Sphinx)
#
# If successful the following variables will be defined
# SPHINX_FOUND
# SPHINX_EXECUTABLE

find_program(SPHINX_EXECUTABLE
NAMES sphinx-build sphinx-build2
DOC "Path to sphinx-build executable")

# Handle REQUIRED and QUIET arguments
# this will also set SPHINX_FOUND to true if SPHINX_EXECUTABLE exists
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Sphinx
"Failed to locate sphinx-build executable"
SPHINX_EXECUTABLE)

2 changes: 0 additions & 2 deletions doc/cookbook/CMakeLists.txt
@@ -1,8 +1,6 @@
#PROJECT(sphinxdoc)
#cmake_minimum_required(VERSION 2.8.8)

set(SPHINX_EXECUTABLE "sphinx-build")

# configured documentation tools and intermediate build results
set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build")

Expand Down

0 comments on commit 301af0f

Please sign in to comment.