From 86aa9bc35ba9dc9a57913a2ffc71619c7657cc35 Mon Sep 17 00:00:00 2001 From: Mathias Preiner Date: Wed, 21 Apr 2021 05:52:27 -0700 Subject: [PATCH] cmake: Add optional module name argument for check_python_module helper. (#6406) Addtionally adds checks for required documentation modules. --- cmake/Helpers.cmake | 10 +++++++--- docs/CMakeLists.txt | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/Helpers.cmake b/cmake/Helpers.cmake index 2a94839e2..bb102e482 100644 --- a/cmake/Helpers.cmake +++ b/cmake/Helpers.cmake @@ -191,13 +191,17 @@ function(check_python_module module) RET_MODULE_TEST ERROR_QUIET ) + set(module_name ${ARGN}) + if(NOT module_name) + set(module_name ${module}) + endif() if(RET_MODULE_TEST) message(FATAL_ERROR - "Could not find module ${module} for Python " + "Could not find module ${module_name} for Python " "version ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}. " - "Make sure to install ${module} for this Python version " - "via \n`${PYTHON_EXECUTABLE} -m pip install ${module}'.\n" + "Make sure to install ${module_name} for this Python version " + "via \n`${PYTHON_EXECUTABLE} -m pip install ${module_name}'.\n" "Note: You need to have pip installed for this Python version.") endif() endfunction() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 2890148b7..4e18c0ba9 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -14,6 +14,8 @@ ## find_package(Sphinx REQUIRED) check_python_module(breathe) +check_python_module(sphinxcontrib.bibtex sphinxcontrib-bibtex) +check_python_module(sphinx_tabs.tabs sphinx-tabs) add_subdirectory(cpp) -- 2.30.2