[Digikam-devel] Re: [Kde-imaging] Re: Re: Git migration for 2.0.0 + code components re-structuring...

Michael G. Hansen mike at mghansen.de
Tue Dec 14 21:36:04 GMT 2010


On 12/14/2010 01:48 PM, Gert Kello wrote:
>> I had these problems before fixing the the FindXXX.cmake files when
>> libkexiv2 was already installed. Maybe you could update to the latest
>> version, where I fixed the FindKexiv2 and FindKipi files. You may want
>> to clear the CMakeCache.txt file to make sure all libraries are found
>> properly.
>
> Yes, latest version did work fine.
>
> Just this OpenCV problems:
> 1. FindOpenCV.cmake included with libkface is not able to find it. If
> I delete it then OpenCV is found
> 2. I have to make a little modification to
> Index: libkface/libkface/CMakeLists.txt
> ===================================================================
> --- kdereview/libkface/libkface/CMakeLists.txt	(revision 1202545)
> +++ kdereview/libkface/libkface/CMakeLists.txt	(working copy)
> @@ -49,7 +49,7 @@
>                               ${KDE4_KDEUI_LIBS}
>                               ${QT_QTGUI_LIBRARY}
>                               ${LIBFACE_LIBRARIES}
> -                            ${OpenCV_LIBRARIES}
> +                            ${OpenCV_LIBS}
>                               )
>
>   SET_TARGET_PROPERTIES(kface PROPERTIES VERSION ${KFACE_LIB_SO_VERSION_STRING}

Here, the problem is that there are two versions of FindOpenCV in the 
wild, one defining OpenCV_LIBRARIES and one defining OpenCV_LIBS. I 
don't know who distributes which version, but at least the one that is 
shipped with libkface defines OpenCV_LIBRARIES. Since we add all 
FindXXX.cmake files from all our libraries to the modules search path, 
CMake should find the FindOpenCV.cmake file in the libkface directory. I 
added an IF-clause to make sure we handle both variable names in the 
future (commit 1206532):

# there are two versions of FindOpenCV.cmake in the wild, one defining
# OpenCV_LIBRARIES, the other defining OpenCV_LIBS. Make sure we handle
# both cases.
IF (NOT OpenCV_LIBRARIES)
   SET(OPENCV_LIBRARIES ${OpenCV_LIBS})
ENDIF (NOT OpenCV_LIBRARIES)

# same story with OpenCV_INCLUDE_DIRS and OpenCV_INCLUDE_DIR:
IF (NOT OpenCV_INCLUDE_DIRS)
   SET(OpenCV_INCLUDE_DIRS ${OpenCV_INCLUDE_DIR})
ENDIF (NOT OpenCV_INCLUDE_DIRS)

> But after all I do not understand why it is arranged like that... If I
> remove the findOpenCV.cmake then the OpenCV is found just fine. Only
> that one file must be updated to use the variable that is defined by
> OpenCV makers... And some files in kipi_plugins as well I think.

I guess the problem here is again the two versions, where the one which 
we ship is incapable of finding your OpenCV installation. Again, with 
the patch above, it should work also with your FindOpenCV.cmake file. 
But it's kind of a hack to ask the user to remove the FindOpenCV.cmake 
in a subdirectory before he can compile, so I added an option to not use 
the FindOpenCV.cmake shipped with libkface in commit 1206536. Add 
-DKFACE_EXTERNAL_FINDOPENCV:BOOL=TRUE to cmake.

I hope this solves all the FindOpenCV issues for now. Please let me know 
whether it works, and thanks for trying it!

Michael



More information about the Digikam-devel mailing list