Upstream-status: Inappropriate [OE specific]

Signed-off-by: Ricardo Ribalda <ricardo.ribalda@gmail.com>
diff --git a/cmake/OpenCVFindLibProtobuf.cmake b/cmake/OpenCVFindLibProtobuf.cmake
index b6ce1e7fd56b..e916ec0df2a6 100644
--- a/cmake/OpenCVFindLibProtobuf.cmake
+++ b/cmake/OpenCVFindLibProtobuf.cmake
@@ -7,21 +7,21 @@ OCV_OPTION(BUILD_PROTOBUF "Force to build libprotobuf from sources" ON)
 OCV_OPTION(PROTOBUF_UPDATE_FILES "Force to rebuild .proto files" OFF)
 
 if(PROTOBUF_UPDATE_FILES)
-  if(NOT DEFINED Protobuf_PROTOC_EXECUTABLE)
+  if(NOT DEFINED PROTOBUF_PROTOC_EXECUTABLE)
     find_package(Protobuf QUIET)
   endif()
-  if(DEFINED Protobuf_PROTOC_EXECUTABLE AND EXISTS ${Protobuf_PROTOC_EXECUTABLE})
-    message(STATUS "The protocol buffer compiler is found (${Protobuf_PROTOC_EXECUTABLE})")
+  if(DEFINED PROTOBUF_PROTOC_EXECUTABLE AND EXISTS ${PROTOBUF_PROTOC_EXECUTABLE})
+    message(STATUS "The protocol buffer compiler is found (${PROTOBUF_PROTOC_EXECUTABLE})")
   else()
-    message(FATAL_ERROR "The protocol buffer compiler is not found (Protobuf_PROTOC_EXECUTABLE='${Protobuf_PROTOC_EXECUTABLE}')")
+    message(FATAL_ERROR "The protocol buffer compiler is not found (PROTOBUF_PROTOC_EXECUTABLE='${PROTOBUF_PROTOC_EXECUTABLE}')")
   endif()
 endif()
 
-if(NOT BUILD_PROTOBUF AND NOT (DEFINED Protobuf_INCLUDE_DIRS AND DEFINED Protobuf_LIBRARIES))
+if(NOT BUILD_PROTOBUF AND NOT (DEFINED PROTOBUF_INCLUDE_DIR AND DEFINED PROTOBUF_LIBRARIES))
   find_package(Protobuf QUIET)
 endif()
 
-if(Protobuf_FOUND)
+if(PROTOBUF_FOUND OR (DEFINED PROTOBUF_INCLUDE_DIR AND DEFINED PROTOBUF_LIBRARIES))
   # nothing
 else()
   set(Protobuf_LIBRARIES libprotobuf)
diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt
index 2a71568d1a44..c6329a742263 100644
--- a/modules/dnn/CMakeLists.txt
+++ b/modules/dnn/CMakeLists.txt
@@ -7,7 +7,7 @@ if(DEFINED BUILD_opencv_dnn AND NOT BUILD_opencv_dnn)
 endif()
 
 include(${OpenCV_SOURCE_DIR}/cmake/OpenCVFindLibProtobuf.cmake)
-if(NOT Protobuf_FOUND)
+if(NOT PROTOBUF_FOUND)
   ocv_module_disable(opencv_dnn)
 endif()
 
@@ -72,7 +72,7 @@ ocv_source_group("Src\\protobuf" FILES ${Protobuf_SRCS} ${Protobuf_HDRS})
 ocv_module_include_directories(include ${Protobuf_INCLUDE_DIRS})
 
 ocv_glob_module_sources(${Protobuf_SRCS} ${Protobuf_HDRS} ${CBLAS_H_PROXY_PATH})
-ocv_create_module(${Protobuf_LIBRARIES} ${LAPACK_LIBRARIES})
+ocv_create_module(${PROTOBUF_LIBRARIES} ${LAPACK_LIBRARIES})
 ocv_add_samples()
 ocv_add_accuracy_tests()
 ocv_add_perf_tests()
