project(ITKVideoBridgeOpenCV)

set(ITKVideoBridgeOpenCV_LIBRARIES ITKVideoBridgeOpenCV)

set(ITKVideoBridgeOpenCV_SYSTEM_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS})
set(ITKVideoBridgeOpenCV_SYSTEM_LIBRARY_DIRS ${OpenCV_LIB_DIR})

itk_module_impl()

project(ITKVideoBridgeOpenCV)

set(ITKVideoBridgeOpenCV_LIBRARIES ITKVideoBridgeOpenCV)

# When this module is loaded by an app, load OpenCV too.
set(ITKVideoBridgeOpenCV_EXPORT_CODE_INSTALL "
set(OpenCV_DIR \"${OpenCV_DIR}\")
find_package(OpenCV REQUIRED)
")
set(ITKVideoBridgeOpenCV_EXPORT_CODE_BUILD "
if(NOT ITK_BINARY_DIR)
  set(OpenCV_DIR \"${OpenCV_DIR}\")
  find_package(OpenCV REQUIRED)
endif()
")

set(ITKVideoBridgeOpenCV_SYSTEM_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS})
set(ITKVideoBridgeOpenCV_SYSTEM_LIBRARY_DIRS ${OpenCV_LIB_DIR})

itk_module_impl()

Add CMake OpenCV export code to ITKVideoBridgeOpenCV.
BUG: Add CMake OpenCV export code to ITKVideoBridgeOpenCV.

This is for:

I have built ITK with BridgeOpenCV turned ON and when I compile ITKExamples, I get the following linking errors:

FAILED: : && /usr/lib/ccache/c++   -msse2  -g   src/CMakeFiles/ImageCompareCommand.dir/ImageCompareCommand.cxx.o  -o bin/ImageCompareCommand  -rdynamic /home/arnaud/install/lib/libITKIOBMP-4.9.so.1 -lexpat -lz /home/arnaud/install/lib/libITKIOGDCM-4.9.so.1 /home/arnaud/install/lib/libITKIOGIPL-4.9.so.1 -ljpeg /home/arnaud/install/lib/libITKIOJPEG-4.9.so.1 /home/arnaud/install/lib/libITKIOMeta-4.9.so.1 /home/arnaud/install/lib/libITKIONIFTI-4.9.so.1 /home/arnaud/install/lib/libITKIONRRD-4.9.so.1 -lpng /home/arnaud/install/lib/libITKIOPNG-4.9.so.1 -ltiff /home/arnaud/install/lib/libITKIOVTK-4.9.so.1 /home/arnaud/install/lib/libITKLabelMap-4.9.so.1 /home/arnaud/install/lib/libITKQuadEdgeMesh-4.9.so.1 /home/arnaud/install/lib/libITKPolynomials-4.9.so.1 /home/arnaud/install/lib/libITKBiasCorrection-4.9.so.1 /home/arnaud/install/lib/libITKBioCell-4.9.so.1 /home/arnaud/install/lib/libITKDICOMParser-4.9.so.1 /home/arnaud/install/lib/libITKIOSpatialObjects-4.9.so.1 /home/arnaud/install/lib/libITKFEM-4.9.so.1 /home/arnaud/install/lib/libITKIOMesh-4.9.so.1 /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5_cpp.so /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5.so -lpthread -ldl -lm /home/arnaud/install/lib/libITKIOBioRad-4.9.so.1 /home/arnaud/install/lib/libITKIOCSV-4.9.so.1 /home/arnaud/install/lib/libITKIOGE-4.9.so.1 /home/arnaud/install/lib/libITKIOSiemens-4.9.so.1 /home/arnaud/install/lib/libITKIOHDF5-4.9.so.1 /home/arnaud/install/lib/libITKIOLSM-4.9.so.1 /home/arnaud/install/lib/libITKIOMRC-4.9.so.1 /home/arnaud/install/lib/libITKIOStimulate-4.9.so.1 /home/arnaud/install/lib/libITKIOTransformHDF5-4.9.so.1 /home/arnaud/install/lib/libITKIOTransformInsightLegacy-4.9.so.1 /home/arnaud/install/lib/libITKIOTransformMatlab-4.9.so.1 /home/arnaud/install/lib/libITKKLMRegionGrowing-4.9.so.1 /home/arnaud/install/lib/libITKWatersheds-4.9.so.1 /home/arnaud/install/lib/libITKOptimizersv4-4.9.so.1 /home/arnaud/install/lib/libITKVideoBridgeOpenCV-4.9.so.1 /home/arnaud/install/lib/libITKVtkGlue-4.9.so.1 /home/arnaud/install/lib/libitkgdcmMSFF-4.9.so.1 /home/arnaud/install/lib/libitkgdcmDICT-4.9.so.1 /home/arnaud/install/lib/libitkgdcmIOD-4.9.so.1 /home/arnaud/install/lib/libitkgdcmDSED-4.9.so.1 /home/arnaud/install/lib/libitkgdcmCommon-4.9.so.1 /home/arnaud/install/lib/libITKNrrdIO-4.9.so.1 /home/arnaud/install/lib/libITKIOXML-4.9.so.1 /home/arnaud/install/lib/libITKMetaIO-4.9.so.1 /home/arnaud/install/lib/libITKgiftiio-4.9.so.1 -lexpat /home/arnaud/install/lib/libITKniftiio-4.9.so.1 /home/arnaud/install/lib/libITKznz-4.9.so.1 /home/arnaud/install/lib/libITKIOIPL-4.9.so.1 /home/arnaud/install/lib/libITKIOTIFF-4.9.so.1 /home/arnaud/install/lib/libITKIOTransformBase-4.9.so.1 /home/arnaud/install/lib/libITKSpatialObjects-4.9.so.1 /home/arnaud/install/lib/libITKMesh-4.9.so.1 /home/arnaud/install/lib/libITKPath-4.9.so.1 /home/arnaud/install/lib/libITKOptimizers-4.9.so.1 /home/arnaud/install/lib/libITKStatistics-4.9.so.1 /home/arnaud/install/lib/libitkNetlibSlatec-4.9.so.1 /home/arnaud/install/lib/libITKVideoIO-4.9.so.1 /home/arnaud/install/lib/libITKIOImageBase-4.9.so.1 /home/arnaud/install/lib/libITKVideoCore-4.9.so.1 -lopencv_videostab -lopencv_video -lopencv_ts -lopencv_superres -lopencv_stitching -lopencv_photo -lopencv_ocl -lopencv_objdetect -lopencv_nonfree -lopencv_ml -lopencv_legacy -lopencv_imgproc -lopencv_highgui -lopencv_gpu -lopencv_flann -lopencv_features2d -lopencv_core -lopencv_contrib -lopencv_calib3d -ljpeg -lpng -ltiff /home/arnaud/install/lib/libITKVTK-4.9.so.1 /home/arnaud/install/lib/libITKCommon-4.9.so.1 /home/arnaud/install/lib/libitkdouble-conversion-4.9.so.1 /home/arnaud/install/lib/libitksys-4.9.so.1 /home/arnaud/install/lib/libITKVNLInstantiation-4.9.so.1 /home/arnaud/install/lib/libitkvnl_algo-4.9.so.1 /home/arnaud/install/lib/libitkv3p_lsqr-4.9.so.1 /home/arnaud/install/lib/libitkvnl-4.9.so.1 /home/arnaud/install/lib/libitkvcl-4.9.so.1 /home/arnaud/install/lib/libitkv3p_netlib-4.9.so.1 -lm -lpthread -lm /home/arnaud/install/lib/libvtkRenderingOpenGL-6.3.so.1 -lGLU -lSM -lICE -lX11 -lXext -lSM -lICE -lX11 -lXext -lXt /home/arnaud/install/lib/libvtkImagingHybrid-6.3.so.1 /home/arnaud/install/lib/libvtkIOImage-6.3.so.1 /home/arnaud/install/lib/libvtkDICOMParser-6.3.so.1 /home/arnaud/install/lib/libvtkIOCore-6.3.so.1 /home/arnaud/install/lib/libvtkmetaio-6.3.so.1 -lz /home/arnaud/install/lib/libvtkRenderingFreeType-6.3.so.1 /home/arnaud/install/lib/libvtkftgl-6.3.so.1 -lfreetype -lGL /home/arnaud/install/lib/libvtkInteractionStyle-6.3.so.1 /home/arnaud/install/lib/libvtkRenderingCore-6.3.so.1 /home/arnaud/install/lib/libvtkCommonColor-6.3.so.1 /home/arnaud/install/lib/libvtkFiltersGeometry-6.3.so.1 /home/arnaud/install/lib/libvtkFiltersExtraction-6.3.so.1 /home/arnaud/install/lib/libvtkFiltersStatistics-6.3.so.1 /home/arnaud/install/lib/libvtkImagingFourier-6.3.so.1 /home/arnaud/install/lib/libvtkalglib-6.3.so.1 /home/arnaud/install/lib/libvtkFiltersSources-6.3.so.1 /home/arnaud/install/lib/libvtkFiltersGeneral-6.3.so.1 /home/arnaud/install/lib/libvtkFiltersCore-6.3.so.1 /home/arnaud/install/lib/libvtkCommonComputationalGeometry-6.3.so.1 /home/arnaud/install/lib/libvtkImagingSources-6.3.so.1 /home/arnaud/install/lib/libvtkImagingCore-6.3.so.1 /home/arnaud/install/lib/libvtkCommonExecutionModel-6.3.so.1 /home/arnaud/install/lib/libvtkCommonDataModel-6.3.so.1 /home/arnaud/install/lib/libvtkCommonMisc-6.3.so.1 /home/arnaud/install/lib/libvtkCommonSystem-6.3.so.1 /home/arnaud/install/lib/libvtksys-6.3.so.1 -ldl /home/arnaud/install/lib/libvtkCommonTransforms-6.3.so.1 /home/arnaud/install/lib/libvtkCommonMath-6.3.so.1 /home/arnaud/install/lib/libvtkCommonCore-6.3.so.1 -Wl,-rpath,/home/arnaud/install/lib:/usr/lib/x86_64-linux-gnu/hdf5/serial/lib -Wl,-rpath-link,/home/arnaud/install/lib && :
/usr/bin/ld: cannot find -lopencv_videostab
/usr/bin/ld: cannot find -lopencv_video
/usr/bin/ld: cannot find -lopencv_ts
/usr/bin/ld: cannot find -lopencv_superres
/usr/bin/ld: cannot find -lopencv_stitching
/usr/bin/ld: cannot find -lopencv_photo
/usr/bin/ld: cannot find -lopencv_ocl
/usr/bin/ld: cannot find -lopencv_objdetect
/usr/bin/ld: cannot find -lopencv_nonfree
/usr/bin/ld: cannot find -lopencv_ml
/usr/bin/ld: cannot find -lopencv_legacy
/usr/bin/ld: cannot find -lopencv_imgproc
/usr/bin/ld: cannot find -lopencv_highgui
/usr/bin/ld: cannot find -lopencv_gpu
/usr/bin/ld: cannot find -lopencv_flann
/usr/bin/ld: cannot find -lopencv_features2d
/usr/bin/ld: cannot find -lopencv_core
/usr/bin/ld: cannot find -lopencv_contrib
/usr/bin/ld: cannot find -lopencv_calib3d
collect2: error: ld returned 1 exit status

Change-Id: Iba39a816e4fdd068e30c62e1f56eff84cbb70adb
