Hello,<br><br>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.<br>Howerver, it seems that keeping the value in the cache make this impossible!<br>
<br>here a sample of my code:<br><br>IF(NOT OpenCV_FOUND)<br><br>SET (OpenCV_POSSIBLE_ROOT_DIRS
<br>"${OpenCV_ROOT_DIR}"
<br>"$ENV{ProgramFiles}/OpenCV"
<br>"/usr/local"
<br>"/usr"<br>)<br><br><br>FIND_PATH(OpenCV_ROOT_DIR_FOUND
<br> NAMES
<br> cv/include/cv.h # windows
<br> include/opencv/cv.h # linux, trunk
<br> include/cv/cv.h
<br> include/cv.h
<br> PATHS ${OpenCV_POSSIBLE_ROOT_DIRS})
<br> <br>SET(OpenCV_ROOT_DIR ${OpenCV_ROOT_DIR_FOUND} CACHE PATH "Set OpenCV root dir if you need to use one particular" FORCE)<br clear="all"><br>... <br><br>Then, the rest of the code use FIND_PATH and FIND_LIBRARY command<br>
with PATHS ${OpenCV_ROOT_DIR} options.<br><br>For example:<br>FIND_LIBRARY(OpenCV_CV_LIBRARY
<br> NAMES cv cv100 cv110
<br> PATHS ${OpenCV_ROOT_DIR}
<br> PATH_SUFFIXES "lib"
<br> NO_DEFAULT_PATH)<br><br><br><br>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)<br><br><br><br>This work correctly when OpenCV is at default location (/usr/ under linux, $ENV{ProgramFiles}/OpenCV under windows). <br>
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).<br>
<br>Thanks in advance for your help!<br><br><br>--<br>Benoit RAT<br><a href="http://www.neub.co.nr">www.neub.co.nr</a><br>