Linux opencv independent installation : not found in CMake -


i creating object tracking program rely on opencv. want able test different versions of opencv have linking errors.

i installed last version of opencv (a69b435c928f422fb5f99c02cf2dcae57dcf820a) in following folder : /usr/local/opencv/opencv-trunk instead of usual /usr/local.

then followed official tutorial use opencv cmake in linux, had following "normal" error :

cmake error @ cmakelists.txt:11 (find_package):   not providing "findopencv.cmake" in cmake_module_path project has asked cmake find package configuration file provided "opencv", cmake did not find one.    not find package configuration file provided "opencv" of following names:      opencvconfig.cmake     opencv-config.cmake    add installation prefix of "opencv" cmake_prefix_path or set "opencv_dir" directory containing 1 of above files.  if "opencv" provides separate development package or sdk, sure has been installed.   -- configuring incomplete, errors occurred! 

so did suggested , added following line in cmakelists.txt :

# find independently installed opencv libraries set(opencv_dir "/usr/local/opencv/opencv-trunk/share/opencv") 

this complete cmakelists.txt file :

# find independently installed opencv libraries set(opencv_dir "/usr/local/opencv/opencv-trunk/share/opencv")  cmake_minimum_required(version 2.8) project( displayimage ) add_executable( displayimage displayimage.cpp )  find_package( opencv required ) include_directories( ${opencv_include_dirs} ) target_link_libraries( displayimage ${opencv_libs} ) 

now have following error , don't find how deal it.

cmake error @ cmakelists.txt:12 (find_package):   found package configuration file:      /usr/local/opencv/opencv-trunk/share/opencv/opencvconfig.cmake    set opencv_found false package "opencv" considered not found.  -- configuring incomplete, errors occurred! 

if have faced issue in such context solutions welcomed ;)

if running intellij or other ide, try re-building cmake cache (or remove build directory , run cmake utility again).

i believe not best practice - set configuration variable opencv_dir hard-coded in cmakelists.txt. try setting manually, environment variable cmake utility:

opencv_dir=/usr/local/cellar/opencv3/3.1.0_2/share/opencv/ cmake .. 

or set ide make you:

cmake environmental variables in intellij/clion


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -