Commit 4037a4f2 authored by Roman Donchenko's avatar Roman Donchenko

Fixed OpenCV_LIBS when find_package has been used with explicit components.

Fixes <http://answers.opencv.org/question/23997/opencv-247-cmake-includes-all-modules-even-if-i/>.
parent e69d2c1b
......@@ -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} "")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment