From 4037a4f227552409f8b9bae99f8e69d0ee59e44e Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Tue, 19 Nov 2013 18:36:58 +0400 Subject: [PATCH] Fixed OpenCV_LIBS when find_package has been used with explicit components. Fixes . --- cmake/templates/OpenCVConfig.cmake.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 91791b64a..6db61d211 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -181,6 +181,10 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS}) set(${__cvcomponent}_FOUND "${__cvcomponent}_FOUND-NOTFOUND") else() list(APPEND OpenCV_FIND_COMPONENTS_ ${__cvcomponent}) + # Not using list(APPEND) here, because OpenCV_LIBS may not exist yet. + # Also not clearing OpenCV_LIBS anywhere, so that multiple calls + # to find_package(OpenCV) with different component lists add up. + set(OpenCV_LIBS ${OpenCV_LIBS} "${__cvcomponent}") #indicate that module is found string(TOUPPER "${__cvcomponent}" __cvcomponent) set(${__cvcomponent}_FOUND 1) @@ -197,8 +201,6 @@ else() set(OpenCV_LIB_SUFFIX "") endif() -SET(OpenCV_LIBS "${OpenCV_LIB_COMPONENTS}") - foreach(__opttype OPT DBG) SET(OpenCV_LIBS_${__opttype} "${OpenCV_LIBS}") SET(OpenCV_EXTRA_LIBS_${__opttype} "")