diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 65b8a0ef..d9c4ad9e 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -102,7 +102,8 @@ if(NOT SPHINX_EXECUTABLE) message_colored(FATAL_ERROR "Failed to locate sphinx-build" 31) endif() -configure_file(conf.py.in conf.py @ONLY) +# Configures conf.py in the current folder and puts it in the build folder +configure_file(conf.py conf.py @ONLY) set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build") separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}") diff --git a/doc/conf.py.in b/doc/conf.py similarity index 94% rename from doc/conf.py.in rename to doc/conf.py index 5d94d815..06109d4a 100644 --- a/doc/conf.py.in +++ b/doc/conf.py @@ -28,6 +28,17 @@ version = '@APP_VERSION@' # The full version, including alpha/beta/rc tags release = version +# is whether we are on readthedocs.io +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +# Set path to documentation +if on_rtd: + # On readthedocs conf.py is already in the doc folder + doc_path = '.' +else: + # In all other builds conf.py is configured with cmake and put into the + # build folder. + doc_path = '@doc_path@' # -- General configuration --------------------------------------------------- @@ -42,7 +53,7 @@ extensions = [ ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['@doc_path@/_templates'] +templates_path = [doc_path + '/_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: @@ -71,9 +82,6 @@ pygments_style = None # -- Options for HTML output ------------------------------------------------- -# is whether we are on readthedocs.io -on_rtd = os.environ.get('READTHEDOCS', None) == 'True' - # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # @@ -91,7 +99,7 @@ else: # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['@doc_path@/_static'] +html_static_path = [doc_path + '/_static'] # Custom sidebar templates, must be a dictionary that maps document names # to template names.