[CMake] Fwd: module and cmake

Rolf Eike Beer eike at sf-mail.de
Sat May 19 09:44:36 EDT 2012


> >> and other libraries I'm using (hdf5,
> >> mkl, ...) share the same fate. Previously I've just hand-added all
> >> sorts of include_directories and link_directories but I'm getting fed
> > 
> > link_directories() is surely not the solution you need. In fact, it
> > usually
> > creates only more problems.
> 
> I know, that's why I'm working on a more elegant solution :)

Use target_link_libraries() with an absolute path to the library.

> > But to have some useful information: set CMAKE_PREFIX_PATH to the path
> > where the libraries can be found without the lib/ or include/ suffix,
> > CMake will add them itself.
> > 
> > So if you have fftw2 in /opt/fftw2/lib/libfftw2.a and fftw3 in
> > /opt/fftw-3/lib/libfftw3.so just call:
> > 
> > cmake -D CMAKE_PREFIX_PATH=/opt/fftw2 ...
> 
> I know that this might be possible. However, I'd like to get CMake to
> read the environment directly, as everything is defined there. This
> will make it easier for other users to compile the code without -D
> CMAKE_PREFIX_PATH=/funny/path-... for several libraries.

If there is a standard environment variable for a library then just put it 
into the Find*.cmake in the HINTS section (again: cmake --help-command 
find_library).

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120519/82db99e6/attachment.pgp>


More information about the CMake mailing list