[CMake] Fwd: module and cmake

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


Am Samstag, 19. Mai 2012, 14:42:49 schrieb Paul Anton Letnes:
> Hi all.
> 
> I am currently trying to create a more tidy CMakeLists.txt script for
> a simulation code I'm working on. The target platforms are mac and
> linux desktops (for development) and HPC [0] servers (all linux or, in
> some hypothetical future, unix systems). For the desktop/laptop case,
> it's mostly easy enough, as one installs libraries in a standard
> location - /opt, /usr/local, or something of that sort. On HPC
> servers, it is very common to install software in "modules". I am not
> sure how well aquainted the CMake crowd is with the module system [1]
> so I'll post a brief explanation.
> 
> HPC servers often have a large amount of users with varying
> requirements. Therefore, it is common to require, say, two different
> versions of a library, or the same library for two different
> compilers. As an example, a machine I'm currently using has several
> modules for the FFTW library. Example:

[...]

> So why am i ranting on about this? Well, basically
> find_package(FFTW3)  does not find the fftw library,

This module is not part of CMake, so you should complain somewhere else.

> 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.

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 ...

Then CMake should pick up that library and all should be well.

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/6291736b/attachment.pgp>


More information about the CMake mailing list