[CMake] FIND_PATH with multiple path in a single variable
Brad King
brad.king at kitware.com
Tue Oct 3 11:15:31 EDT 2006
frederic heem wrote:
> Hi,
> Here is the problem, pkgconfig is used to get the include path, for dbus, its
> value is "-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include" and the
> variable name is DBUS_INCLUDE_DIR_SYSTEM. The following FIND_PATH fails to
> find the include files:
> FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
> ${DBUS_INCLUDE_DIR_SYSTEM}
> )
>
> Is it a known issue ?
There are a few problems here. First, paths are specified using the
PATHS keyword:
FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
PATHS ${DBUS_INCLUDE_DIR_SYSTEM}
)
Second, the output of pkgconfig cannot be used directly. FIND_PATH does
not recognize the string "-I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include" as a list of search paths. You have to use
STRING(REGEX) to parse out the paths. Once you have them you don't
actually need FIND_PATH at all though. Just set DBUS_INCLUDE_DIRS to
the result.
-Brad
More information about the CMake
mailing list