[CMake] FIND_PATH / FIND_LIBRARY order

gga ggarra at advancedsl.com.ar
Sun Jun 10 05:54:50 EDT 2007


Currently, using cmake2.5, I am finding the lookup order of FIND_PATH /
FIND_LIBRARY to be counter productive, so I'm wondering if this is a bug
or intended behavior.  If intended behavior, I would also want to know
what's the proper way around it.

Currently I have a project that may require some newer libraries than
those shipped with my Unix system.  Those get manually compiled with
autoconf and placed under /usr/local.

My problem is that FIND_PATH / FIND_LIBRARY locate the equivalent
libraries in /usr/ instead of those in /usr/local, leading to problems.

Sure enough, if I print:

MESSAGE( "CMAKE_SYSTEM_INCLUDE_PATH=${CMAKE_SYSTEM_INCLUDE_PATH}" )
MESSAGE( "CMAKE_SYSTEM_LIBRARY_PATH=${CMAKE_SYSTEM_LIBRARY_PATH}" )

I find that:

CMAKE_SYSTEM_INCLUDE_PATH=/include;/usr/include;/usr/local/include;...
CMAKE_SYSTEM_LIBRARY_PATH=/lib;/usr/lib;/usr/local/lib;/usr/lib/w32api;...

That is:

/usr/local/include and /usr/local/lib are placed *after* the main
includes for the system.  This makes it impossible to override some
system library with a local one.

Now... isn't this totally backwards!?

I mean, my LD_LIBRARY_PATH is usually this:
/usr/local/lib:/usr/lib:/lib:/usr/local/lib32/:/usr/lib32:/lib32:

/usr/local/lib is usually a directory where a local admin may have
access to, while /usr is closed to everybody except root.

-- 
Gonzalo Garramuño
ggarra at advancedsl.com.ar

AMD4400 - ASUS48N-E
GeForce7300GT
Kubuntu Edgy


More information about the CMake mailing list