Hello,

I'm using the different version of the OpenCV library and i would like to
make it easy to switch from one to another by changing its path in
cmake-gui.
Howerver, it seems that keeping the value in the cache make this impossible!

here a sample of my code:

IF(NOT OpenCV_FOUND)

SET (OpenCV_POSSIBLE_ROOT_DIRS
"${OpenCV_ROOT_DIR}"
"$ENV{ProgramFiles}/OpenCV"
"/usr/local"
"/usr"
)


FIND_PATH(OpenCV_ROOT_DIR_FOUND
  NAMES
  cv/include/cv.h     # windows
  include/opencv/cv.h # linux, trunk
  include/cv/cv.h
  include/cv.h
  PATHS ${OpenCV_POSSIBLE_ROOT_DIRS})

SET(OpenCV_ROOT_DIR ${OpenCV_ROOT_DIR_FOUND} CACHE PATH "Set OpenCV root dir
if you need to use one particular"  FORCE)

...

Then, the rest of the code use FIND_PATH and FIND_LIBRARY command
with PATHS ${OpenCV_ROOT_DIR} options.

For example:
FIND_LIBRARY(OpenCV_CV_LIBRARY
  NAMES cv cv100 cv110
  PATHS ${OpenCV_ROOT_DIR}
  PATH_SUFFIXES "lib"
  NO_DEFAULT_PATH)



And if all the necessary component are found I use, SET(OpenCV_FOUND ON
CACHE BOOL "Tag If the openCV library has been find" FORCE)



This work correctly when OpenCV is at default location (/usr/ under linux,
$ENV{ProgramFiles}/OpenCV under windows).
However, If want to override this path by another one: I first set
OpenCV_FOUND to false, and change the OpenCV_ROOT_DIR, then i reload the
variable using Configure Option in Cmake. But this piece of code doesn't
work and my variable stay unchanged! Someone can tell me where i did wrong
(I think is using cache variable, but i don't really know how to handle it).

Thanks in advance for your help!


--
Benoit RAT
www.neub.co.nr
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to