diff --git a/modules/python/common.cmake b/modules/python/common.cmake index c65cddcf7f..830e4cbc45 100644 --- a/modules/python/common.cmake +++ b/modules/python/common.cmake @@ -135,10 +135,14 @@ if(NOT OPENCV_SKIP_PYTHON_LOADER AND DEFINED OPENCV_PYTHON_INSTALL_PATH) set(OPENCV_PYTHON_INSTALL_PATH_SETUPVARS "${OPENCV_PYTHON_INSTALL_PATH}" CACHE INTERNAL "") endif() -if(NOT " ${PYTHON}" STREQUAL " PYTHON" AND DEFINED OPENCV_${PYTHON}_INSTALL_PATH) - set(__python_binary_install_path "${OPENCV_${PYTHON}_INSTALL_PATH}") -elseif(OPENCV_SKIP_PYTHON_LOADER AND DEFINED ${PYTHON}_PACKAGES_PATH) - set(__python_binary_install_path "${${PYTHON}_PACKAGES_PATH}") +if(OPENCV_SKIP_PYTHON_LOADER) + if(DEFINED OPENCV_${PYTHON}_INSTALL_PATH) + set(__python_binary_install_path "${OPENCV_${PYTHON}_INSTALL_PATH}") + elseif(DEFINED ${PYTHON}_PACKAGES_PATH) + set(__python_binary_install_path "${${PYTHON}_PACKAGES_PATH}") + else() + message(FATAL_ERROR "Specify 'OPENCV_${PYTHON}_INSTALL_PATH' variable") + endif() else() ocv_assert(DEFINED OPENCV_PYTHON_INSTALL_PATH) set(__python_binary_install_path "${OPENCV_PYTHON_INSTALL_PATH}/${__python_loader_subdir}python-${${PYTHON}_VERSION_MAJOR}.${${PYTHON}_VERSION_MINOR}") diff --git a/modules/python/standalone.cmake b/modules/python/standalone.cmake index a27bba0b28..1188a02eb9 100644 --- a/modules/python/standalone.cmake +++ b/modules/python/standalone.cmake @@ -5,11 +5,10 @@ include("${OpenCV_BINARY_DIR}/opencv_python_config.cmake") if(NOT DEFINED OpenCV_SOURCE_DIR) message(FATAL_ERROR "Missing OpenCV_SOURCE_DIR") endif() -if(NOT OPENCV_PYTHON_INSTALL_PATH) - if(NOT DEFINED OPENCV_PYTHON_STANDALONE_INSTALL_PATH) - message(FATAL_ERROR "Missing OPENCV_PYTHON_STANDALONE_INSTALL_PATH / OPENCV_PYTHON_INSTALL_PATH") - endif() +if(DEFINED OPENCV_PYTHON_STANDALONE_INSTALL_PATH) set(OPENCV_PYTHON_INSTALL_PATH "${OPENCV_PYTHON_STANDALONE_INSTALL_PATH}") +elseif(NOT OPENCV_PYTHON_INSTALL_PATH) + message(FATAL_ERROR "Missing OPENCV_PYTHON_STANDALONE_INSTALL_PATH / OPENCV_PYTHON_INSTALL_PATH") endif() include("${OpenCV_SOURCE_DIR}/cmake/OpenCVUtils.cmake")