diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index ee1eb59969..094cbd4d05 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -16,6 +16,7 @@ # If the module is found then OPENCV__FOUND is set to TRUE. # # This file will define the following variables: +# - OpenCV_FOUND : Set to TRUE is OpenCV was find_packaged before # - OpenCV_LIBS : The list of all imported targets for OpenCV modules. # - OpenCV_INCLUDE_DIRS : The OpenCV include directories. # - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability @@ -41,7 +42,10 @@ if(ANDROID) string(REPLACE - _ modules_file_suffix "_${ANDROID_NDK_ABI_NAME}") endif() -include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${modules_file_suffix}.cmake) +if(NOT OpenCV_FOUND) + include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${modules_file_suffix}.cmake) + set(OpenCV_FOUND TRUE) +endif() # TODO All things below should be reviewed. What is about of moving this code into related modules (special vars/hooks/files)