[CMake] Extract list of libraries with full path from link command line

Michele Dolfi dolfimeth at gmail.com
Thu Oct 29 08:50:57 EDT 2015


Hi,

Here is my problem.
Having a string like "-L/mydir/lib -lfoo -lbar", is there a 'nice'
automated way to turn it into a proper list of libraries like
"/mydir/lib/libfoo.dylib;/mydir/lib/libbar.dylib"?

Or, is there a way for cmake to make this magic happen when I pass the
above string to target_link_libraries()?
E.g. target_link_libraries(app "-L/mydir/lib -lfoo -lbar") turning to full
path while linking.


I know that I could come up with regex and do the magic myself like it is
the case in the FindMPI.cmake module, but this looks to me like a standard
procedure that maybe there is a better way then copying almost 100 lines in
every package file.


Thanks a lot,
Michele
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151029/57411f23/attachment.html>


More information about the CMake mailing list