On Monday 15 November 2010, Marek Szuba wrote:
> Hello,
>
> To begin with, a bit of background. The project which I've been
> converting to CMake depends on a certain binary-only library. This
> library is available in several versions, differing in what Fortran
> compiler has been used to produce it; to make things simple let's
> assume there are only two such variants, one for g77 and one for PGI
> Fortran. The latter version is not explicitly linked against PGI
> run-time libraries, making it necessary to include these libraries in
> my project's build scripts.
>
> The problem at hand is that I would like my build scripts to
> automatically recognise the variant of the binary-only library. So
> far, i.e. in hand-crafted makefiles, this has been done by looking for
> PGI Fortan-specific symbols with nm, like this:
>
>       need_pgf = $(strip $(shell nm libX.so | grep ftn_i_sign))
>       ifneq ($(need_pgf),)
>               LIBS  += -L$(PGI)/lib -lpgc -lpgftnrtl
>       endif
>
> What do you think would be the best way of implementing something to
> similar effect in CMake, guys?

You could do the same.

find_library(MY_X_LIB X)
if (MY_X_LIB)
   execute_process(COMMAND nm ${MY_X_LIB}
                   COMMAND grep ftn_i_sign
                   OUTPUT_VARIABLE _grepOutpout)
   ... check for something in _grepOutput using string() or if( MATCHES)...
endif (MY_X_LIB)

Alex
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to