diff --git a/CMakeLists.txt b/CMakeLists.txt index 09cde11480500c219eec34bc37e867ff1a5150c0..727630fe544ea22be3eba6232589db6799af8cc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # Author: Marco Biasini #------------------------------------------------------------------------------- -cmake_minimum_required(VERSION 3.12.1 FATAL_ERROR) +cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) # Set CMake policies # Behaviour of target_link_libraries, always link by full path. CMP0060 can @@ -277,8 +277,8 @@ if (ENABLE_GUI) find_package(Qt5Widgets REQUIRED) find_package(Qt5OpenGL REQUIRED) set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Gui Qt5::Widgets Qt5::Core) - ost_find_python_module(PyQt5.sip) ost_find_python_module(PyQt5) + ost_find_python_module_alt("PyQt5.sip;sip") endif() if (ENABLE_SPNAV) diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake index 41e8f7a7802a229fe596c47dc0e02d769070ce50..3b6821210f742eefd36ca60cef70bc4674c6a41f 100644 --- a/cmake_support/OST.cmake +++ b/cmake_support/OST.cmake @@ -759,6 +759,34 @@ macro(ost_find_python_module MODULE) endif() endmacro() +#------------------------------------------------------------------------------- +# make sure the previously detected Python interpreter has the given module +# while allowing alternative module names +#------------------------------------------------------------------------------- +macro(ost_find_python_module_alt MODULES) + set(_PY_MODS "") + foreach(py_mod ${MODULES}) + if (NOT PYTHON_MODULE_${py_mod}) + set(_PY_MODS "${_PY_MODS} ${py_mod}") + message(STATUS "Searching for python module ${py_mod} for ${PYTHON_BINARY}") + execute_process(COMMAND ${PYTHON_BINARY} -c "import ${py_mod}" + OUTPUT_QUIET ERROR_QUIET + RESULT_VARIABLE _IMPORT_ERROR) + if (NOT _IMPORT_ERROR) + message(STATUS "Found python module ${py_mod}") + set("PYTHON_MODULE_${py_mod}" FOUND CACHE STRING "" FORCE) + break() + endif (NOT _IMPORT_ERROR) + else () + message(STATUS "Already found python module ${py_mod}") + unset(_IMPORT_ERROR) + break() + endif (NOT PYTHON_MODULE_${py_mod}) + endforeach(py_mod ${MODULES}) + if (_IMPORT_ERROR) + message(FATAL_ERROR "Could not find one of python modules ${_PY_MODS}. Please install one of them.") + endif () +endmacro() #------------------------------------------------------------------------------- # this macro tries to detect a very common problem during configuration stage: