This should be in cmake/OpenCVDetectPython.cmake within the `if(BUILD_DOCS)` block.