[CMake] Several questions/problems on FIND_* search behavior

E. Wing ewmailing at gmail.com
Wed Apr 11 19:45:17 EDT 2007


Several questions/problems on FIND_* search behavior:

1) Somebody complained to me that FIND_FILE was not finding things in
the paths that the documentation say they should be in. I confirmed on
OS X. I don't know about other platforms.

So if I do:
FIND_FILE(FOO libm.dylib)
I'm expecting it to find it in /usr/lib, but it doesn't turn up a hit.
Among other paths, I'm expecting /usr/include and /usr/lib to be
searched. I'm also kind of expecting /usr to be searched. But copying
the file around didn't seem to produce any hits. So what's the real
story here? (FYI: I can explicitly add the PATHS and it will be found,
and FIND_LIBRARY does find it.)


2) I'm trying to use CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH. I set
my environment like
export CMAKE_LIBRARY_PATH=/path/to/lib1:/path/to/lib2
export CMAKE_INCLUDE_PATH=/path/to/include

So far, these haven't turned up any hits for me. I tried on both Mac
and Linux, CMake versions 2.4.

3) Is it possible to list multiple potential paths for an $ENV{FOO}
variable? So if I do:
export FOO=../Dir1:../Dir2
and my script has:
FIND_LIBRARY(FOO foo PATHS $ENV{FOO}),
will this work?
(So far my tests say no, but I would like to know if this can work.)


4) Finally, back to FIND_LIBRARY(FOO foo PATHS $ENV{FOO}),
how do I make CMake search my system paths last. I want my $ENV{FOO}
to be like an override, but my system installed stuff keeps getting
found first, before my $ENV{FOO} is checked.

Thanks,
Eric


More information about the CMake mailing list