diff --git a/modules/python/common.cmake b/modules/python/common.cmake index 1a6cc97429..0ea4ee7b27 100644 --- a/modules/python/common.cmake +++ b/modules/python/common.cmake @@ -232,8 +232,9 @@ if(NOT OPENCV_SKIP_PYTHON_LOADER) if(extra_py_files) list(SORT extra_py_files) foreach(f ${extra_py_files}) + get_filename_component(__dir "${f}" DIRECTORY) configure_file("${__base}/${f}" "${__loader_path}/cv2/_extra_py_code/${f}" COPYONLY) - install(FILES "${__base}/${f}" DESTINATION "${OPENCV_PYTHON_INSTALL_PATH}/cv2/_extra_py_code/${f}" COMPONENT python) + install(FILES "${__base}/${f}" DESTINATION "${OPENCV_PYTHON_INSTALL_PATH}/cv2/_extra_py_code/${__dir}/" COMPONENT python) endforeach() else() message(WARNING "Module ${m} has no .py files in misc/python/package")