[CMake] New FIND_* stuff checked into CVS
Brad King
brad.king at kitware.com
Sat Mar 4 11:47:34 EST 2006
Filipe Sousa wrote:
> Bill Hoffman wrote:
>>FIND_PATH(QT_INCLUDE NAMES qt.h PATH_SUFFIXES qt)
>>
>>CMake will find it in /usr/local/include/qt/qt.h and set QT_INCLUDE
>>to /usr/local/include.
>
> fsousa at black ~/tmp/find/build $ ls -l /usr/local/include/qt/qt.h
> - -rw-r--r-- 1 root root 0 Mar 4 11:00 /usr/local/include/qt/qt.h
>
> FIND_PATH(QT_INCLUDE NAMES qt.h PATH_SUFFIXES qt)
> MESSAGE(STATUS ${QT_INCLUDE})
[snip]
> Here QT_INCLUDE is /usr/local/include/qt and not /usr/local/include
This is the intended behavior, Bill's example was incorrect. If you
want to find qt/qt.h then you would still do
FIND_PATH(QT_INCLUDE NAMES qt/qt.h)
The purpose of the PATH_SUFFIXES option is to provide extra places to
look in subdirectories of those in the rest of the search path. The
motivation is libraries like libxml2 which on Windows installs to
PREFIX/include/libxml2/libxml/*.h, but the include files are supposed to
be libxml/*.h. In order to avoid requiring users to list the libxml2
subdirectory in their search path one may use the PATH_SUFFIXES option:
FIND_PATH(
LIBXML2_INCLUDE_DIR
NAMES libxml/xpath.h
PATH_SUFFIXES libxml2
)
This will set LIBXML2_INCLUDE_DIR to PREFIX/include/libxml2 even though
only PREFIX/include was in the search path (presumably in
CMAKE_SYSTEM_INCLUDE_PATH).
-Brad
More information about the CMake
mailing list