Gracefully disable docs if Sphinx is not found. - Also fixes a typo in the search paths in FindSphinx.cmake. Change-Id: I8da50ffd85358f7e67445b02eabfc9cf57c97935
diff --git a/CMakeLists.txt b/CMakeLists.txt index e33a43e..e40dd17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -188,7 +188,7 @@ # Apple claims that the BLAS call dsyrk_ is a private API, and will not allow you # to submit to the Apple Store if the symbol is present. UPDATE_CACHE_VARIABLE(LAPACK OFF) - + MESSAGE(STATUS "Building for iOS: SuiteSparse, CXSparse, LAPACK, gflags, and OpenMP are not available.") UPDATE_CACHE_VARIABLE(BUILD_EXAMPLES OFF) @@ -786,11 +786,16 @@ ADD_SUBDIRECTORY(internal/ceres) IF (BUILD_DOCUMENTATION) - MESSAGE("-- Documentation building is enabled") - - # Generate the User's Guide (html). - # The corresponding target is UserGuide, but is included in ALL. - ADD_SUBDIRECTORY(docs) + FIND_PACKAGE(Sphinx QUIET) + IF (NOT SPHINX_FOUND) + MESSAGE("-- Failed to find Sphinx, disabling build of documentation.") + UPDATE_CACHE_VARIABLE(BUILD_DOCUMENTATION OFF) + ELSE() + # Generate the User's Guide (html). + # The corresponding target is ceres_docs, but is included in ALL. + MESSAGE("-- Build the HTML documentation.") + ADD_SUBDIRECTORY(docs) + ENDIF() ENDIF (BUILD_DOCUMENTATION) IF (BUILD_EXAMPLES)
diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake index 86c172e..aebf615 100644 --- a/cmake/FindSphinx.cmake +++ b/cmake/FindSphinx.cmake
@@ -54,7 +54,7 @@ PATHS /usr/bin /usr/local/bin - /opt/loca/bin + /opt/local/bin DOC "Sphinx documentation generator") ENDFOREACH () ENDIF ()