diff --git a/modules/python/common.cmake b/modules/python/common.cmake index b69d13d5ae..6a438fd1a2 100644 --- a/modules/python/common.cmake +++ b/modules/python/common.cmake @@ -164,7 +164,12 @@ if(OPENCV_SKIP_PYTHON_LOADER) 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}") + if(${PYTHON}_LIMITED_API) + set(__python_binary_subdir "python-${${PYTHON}_VERSION_MAJOR}") + else() + set(__python_binary_subdir "python-${${PYTHON}_VERSION_MAJOR}.${${PYTHON}_VERSION_MINOR}") + endif() + set(__python_binary_install_path "${OPENCV_PYTHON_INSTALL_PATH}/${__python_loader_subdir}${__python_binary_subdir}") endif() install(TARGETS ${the_module} @@ -192,7 +197,7 @@ if(NOT OPENCV_SKIP_PYTHON_LOADER) set(CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE "LOADER_DIR") endif() - if(DEFINED ${PYTHON}_VERSION_MINOR) + if(DEFINED ${PYTHON}_VERSION_MINOR AND NOT ${PYTHON}_LIMITED_API) set(__target_config "config-${${PYTHON}_VERSION_MAJOR}.${${PYTHON}_VERSION_MINOR}.py") else() set(__target_config "config-${${PYTHON}_VERSION_MAJOR}.py")