From 9007a02302809aefe5da9bd7f1bd2fd5a4640cf6 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Wed, 13 Nov 2013 12:25:44 +0100 Subject: [PATCH 1/3] fixes http://code.opencv.org/issues/3367 --- cmake/templates/OpenCVConfig.cmake.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) From ee7c74ceeb2b28fdde0229b9f51d33071110a85d Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Wed, 13 Nov 2013 14:20:09 +0100 Subject: [PATCH 2/3] return when OpenCV is found --- cmake/templates/OpenCVConfig.cmake.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 094cbd4d05..5d5635119c 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -37,15 +37,17 @@ # # =================================================================================== +if(OpenCV_FOUND) + return() +endif() +set(OpenCV_FOUND TRUE) + set(modules_file_suffix "") if(ANDROID) string(REPLACE - _ modules_file_suffix "_${ANDROID_NDK_ABI_NAME}") endif() -if(NOT OpenCV_FOUND) - include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${modules_file_suffix}.cmake) - set(OpenCV_FOUND TRUE) -endif() +include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${modules_file_suffix}.cmake) # TODO All things below should be reviewed. What is about of moving this code into related modules (special vars/hooks/files) From 8e944cfe70679f2c605899d354606d09bec8ccb0 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Thu, 14 Nov 2013 11:45:42 +0100 Subject: [PATCH 3/3] cleaner fix --- cmake/templates/OpenCVConfig.cmake.in | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 5d5635119c..91791b64a7 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -16,7 +16,6 @@ # 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 @@ -37,17 +36,14 @@ # # =================================================================================== -if(OpenCV_FOUND) - return() -endif() -set(OpenCV_FOUND TRUE) - set(modules_file_suffix "") if(ANDROID) string(REPLACE - _ modules_file_suffix "_${ANDROID_NDK_ABI_NAME}") endif() -include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${modules_file_suffix}.cmake) +if(NOT TARGET opencv_core) + include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${modules_file_suffix}.cmake) +endif() # TODO All things below should be reviewed. What is about of moving this code into related modules (special vars/hooks/files)