diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index d02b7596a6..31c2c1e778 100644 --- a/cmake/OpenCVDetectPython.cmake +++ b/cmake/OpenCVDetectPython.cmake @@ -38,7 +38,9 @@ if(PYTHON_EXECUTABLE) if(NOT ANDROID AND NOT IOS) ocv_check_environment_variables(PYTHON_LIBRARY PYTHON_INCLUDE_DIR) - if(CMAKE_VERSION VERSION_GREATER 2.8.8 AND PYTHON_VERSION_FULL) + if(CMAKE_CROSSCOMPILING) + find_host_package(PythonLibs ${PYTHON_VERSION_MAJOR_MINOR}) + elseif(CMAKE_VERSION VERSION_GREATER 2.8.8 AND PYTHON_VERSION_FULL) find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT) else() find_host_package(PythonLibs ${PYTHON_VERSION_FULL})