Re: [CMake] problem with cmake script.

2009-03-09 Thread Adolfo Rodríguez
I was also fooled by that sentence some time ago, but careful reading of
what the doc says after "If NO_DEFAULT_PATH is not specified, the search
process is as follows:" suggests something different.

What I currently do to solve the issue of nonstandard package locations is
to use an environment variable called Foo_ROOT_DIR (for package Foo), as
suggested 
here.
If you're interested, I could send you a FindOpenCV.cmake script that works
like this.

Cheers,

Adolfo

On Mon, Mar 9, 2009 at 11:19 AM, Benoit RAT (Gmail) wrote:

> Thanks Adolfo... but it's kind of strange behavior 
> I thought that i will first look in my specific path and then in the
> default path as it say in the doc:
>
> *The default search order is designed to be most-specific to
>> least-specific for common use cases.
>> *
>
>
>
>
>
>
>
>
> --
> Benoit RAT
> www.neub.co.nr
>
>
> On Mon, Mar 9, 2009 at 10:57 AM, Adolfo Rodríguez wrote:
>
>> Hi Benoit,
>>
>> The documentation of 
>> find_pathspecifies
>>  the order in which paths are searched. If you want to force the
>> /opt path to be searched first, you should maybe try
>>
>> find_path( NAMES name PATHS ${NONSTANDARD_PATHS} NO_DEFAULT_PATH)
>> find_path( NAMES name)
>>
>> This part is documented at the very end of the find_path doc.
>>
>>
>> On Mon, Mar 9, 2009 at 10:40 AM, Benoit  wrote:
>>
>>>  Hello,
>>>
>>> I'm having some trouble to use a cmake script correctly and i don't know
>>> why.
>>> The cmake script come from the openCV library (you can find it here:
>>> http://opencv.willowgarage.com/wiki/Getting_started?action=AttachFile&do=get&target=FindOpenCV.cmake)
>>> and it search for include and library files.
>>>
>>> In this script you can setup the path where you want to look for these
>>> files, (or let the script search the default path).
>>> The problem is that if i have to version of openCV (one in the default
>>> path and one in a special path), it alway select me the default path.
>>>
>>> Here you have the important part of the script:
>>>
>>> -
>>>
>>> MESSAGE(STATUS "OpenCV_POSSIBLE_ROOT_DIRS=${OpenCV_POSSIBLE_ROOT_DIRS}")
>>>
>>> FIND_PATH(OpenCV_ROOT_DIR
>>>   NAMES
>>>   cv/include/cv.h # windows
>>>   include/opencv/cv.h # linux /opt/net
>>>   include/cv/cv.h
>>>   include/cv.h
>>>   PATHS ${OpenCV_POSSIBLE_ROOT_DIRS})
>>>
>>> MESSAGE(STATUS "Selected OpenCV_ROOT_DIR=${OpenCV_ROOT_DIR}")
>>>
>>> SET(OpenCV_INCDIR_SUFFIXES
>>>   include
>>>   include/cv
>>>   include/opencv
>>>   cv/include
>>>   cxcore/include
>>>   cvaux/include
>>>   otherlibs/cvcam/include
>>>   otherlibs/highgui
>>>   otherlibs/highgui/include
>>>   otherlibs/_graphics/include
>>>   )
>>>
>>>
>>> MESSAGE(STATUS "OpenCV_HIGHGUI_INCLUDE_DIR=${OpenCV_HIGHGUI_INCLUDE_DIR}
>>> ; root=${OpenCV_ROOT_DIR}")
>>>
>>> FIND_PATH(OpenCV_HIGHGUI_INCLUDE_DIR
>>>   NAMES highgui.h
>>>   PATHS ${OpenCV_ROOT_DIR}
>>>   PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} )
>>>
>>>  MESSAGE(STATUS "OpenCV_HIGHGUI_INCLUDE_DIR=${OpenCV_HIGHGUI_INCLUDE_DIR}
>>> ${OpenCV_ROOT_DIR}")
>>>
>>> -
>>>
>>>
>>> And here you have the first execution of cmake script when the cache
>>> empty.
>>>
>>> OpenCV_POSSIBLE_ROOT_DIRS=/opt/opencv/1.1.0;usr/local;/usr;
>>>
>>> Selected OpenCV_ROOT_DIR=/opt/opencv/1.1.0
>>>
>>> OpenCV_HIGHGUI_INCLUDE_DIR= ; root=/opt/opencv/1.1.0
>>>
>>> OpenCV_HIGHGUI_INCLUDE_DIR=/usr/include/opencv ; root=/opt/opencv/1.1.0
>>>
>>>
>>>
>>>
>>> -
>>>
>>> Does anyone know why the result of
>>> OpenCV_HIGHGUI_INCLUDE_DIR=/usr/include/opencv and not
>>> /opt/opencv/1.1.0/include/opencv
>>> even if both files /opt/opencv/1.1.0/include/opencv/highgui.h
>>> and/usr/include/opencv/highgui.h  exist in my path.
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>>
>>
>> --
>> Adolfo Rodríguez Tsouroukdissian
>>
>> Robotics engineer
>> PAL ROBOTICS S.L
>> http://www.pal-robotics.com
>> Tel. +34.93.414.53.47
>> Fax.+34.93.209.11.09
>>
>
>


-- 
Adolfo Rodríguez Tsouroukdissian

Robotics engineer
PAL ROBOTICS S.L
http://www.pal-robotics.com
Tel. +34.93.414.53.47
Fax.+34.93.209.11.09
___
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://ww

Re: [CMake] problem with cmake script.

2009-03-09 Thread Adolfo Rodríguez
Hi Benoit,

The documentation of
find_pathspecifies
the order in which paths are searched. If you want to force the
/opt path to be searched first, you should maybe try

find_path( NAMES name PATHS ${NONSTANDARD_PATHS} NO_DEFAULT_PATH)
find_path( NAMES name)

This part is documented at the very end of the find_path doc.

On Mon, Mar 9, 2009 at 10:40 AM, Benoit  wrote:

> Hello,
>
> I'm having some trouble to use a cmake script correctly and i don't know
> why.
> The cmake script come from the openCV library (you can find it here:
> http://opencv.willowgarage.com/wiki/Getting_started?action=AttachFile&do=get&target=FindOpenCV.cmake)
> and it search for include and library files.
>
> In this script you can setup the path where you want to look for these
> files, (or let the script search the default path).
> The problem is that if i have to version of openCV (one in the default path
> and one in a special path), it alway select me the default path.
>
> Here you have the important part of the script:
>
> -
>
> MESSAGE(STATUS "OpenCV_POSSIBLE_ROOT_DIRS=${OpenCV_POSSIBLE_ROOT_DIRS}")
>
> FIND_PATH(OpenCV_ROOT_DIR
>   NAMES
>   cv/include/cv.h # windows
>   include/opencv/cv.h # linux /opt/net
>   include/cv/cv.h
>   include/cv.h
>   PATHS ${OpenCV_POSSIBLE_ROOT_DIRS})
>
> MESSAGE(STATUS "Selected OpenCV_ROOT_DIR=${OpenCV_ROOT_DIR}")
>
> SET(OpenCV_INCDIR_SUFFIXES
>   include
>   include/cv
>   include/opencv
>   cv/include
>   cxcore/include
>   cvaux/include
>   otherlibs/cvcam/include
>   otherlibs/highgui
>   otherlibs/highgui/include
>   otherlibs/_graphics/include
>   )
>
>
> MESSAGE(STATUS "OpenCV_HIGHGUI_INCLUDE_DIR=${OpenCV_HIGHGUI_INCLUDE_DIR} ;
> root=${OpenCV_ROOT_DIR}")
>
> FIND_PATH(OpenCV_HIGHGUI_INCLUDE_DIR
>   NAMES highgui.h
>   PATHS ${OpenCV_ROOT_DIR}
>   PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} )
>
>  MESSAGE(STATUS "OpenCV_HIGHGUI_INCLUDE_DIR=${OpenCV_HIGHGUI_INCLUDE_DIR}
> ${OpenCV_ROOT_DIR}")
>
> -
>
>
> And here you have the first execution of cmake script when the cache empty.
>
> OpenCV_POSSIBLE_ROOT_DIRS=/opt/opencv/1.1.0;usr/local;/usr;
>
> Selected OpenCV_ROOT_DIR=/opt/opencv/1.1.0
>
> OpenCV_HIGHGUI_INCLUDE_DIR= ; root=/opt/opencv/1.1.0
>
> OpenCV_HIGHGUI_INCLUDE_DIR=/usr/include/opencv ; root=/opt/opencv/1.1.0
>
>
>
>
> -
>
> Does anyone know why the result of
> OpenCV_HIGHGUI_INCLUDE_DIR=/usr/include/opencv and not
> /opt/opencv/1.1.0/include/opencv
> even if both files /opt/opencv/1.1.0/include/opencv/highgui.h
> and/usr/include/opencv/highgui.h  exist in my path.
>
>
>
> --
> 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
>



-- 
Adolfo Rodríguez Tsouroukdissian

Robotics engineer
PAL ROBOTICS S.L
http://www.pal-robotics.com
Tel. +34.93.414.53.47
Fax.+34.93.209.11.09
___
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

Re: [CMake] problem with cmake script.

2009-03-09 Thread Eric Noulard
2009/3/9 Benoit :
> Hello,
>
> I'm having some trouble to use a cmake script correctly and i don't know
> why.
[...]

>
> Does anyone know why the result of
> OpenCV_HIGHGUI_INCLUDE_DIR=/usr/include/opencv and not
> /opt/opencv/1.1.0/include/opencv
> even if both files /opt/opencv/1.1.0/include/opencv/highgui.h
> and/usr/include/opencv/highgui.h  exist in my path.

Nope but did you carefully read  the help of find_path
concerning the rule used for search path?

http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_path

may be the explanation is already there.

-- 
Erk
___
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