[CMake] Extract Libs and link_flags From [lib]-config --ldflags

Xavier Larrode Xavier.Larrode at irisa.fr
Wed Aug 23 05:51:21 EDT 2006


i've done this and it's ok :
SET(OMK_LIBDIR_EXTRACT_REGEX "[-][l]([a-zA-Z0-9]*)")
IF("${OMK_LDFLAGS}" MATCHES "${OMK_LIBDIR_EXTRACT_REGEX}")
  STRING(REGEX REPLACE "${OMK_LIBDIR_EXTRACT_REGEX}" ""
    OMK_LIBDIR "${OMK_LDFLAGS}")
  #erase space
  STRING(REGEX REPLACE " " "" OMK_LIBDIR "${OMK_LIBDIR}")
  #replace -L par espace
  STRING(REGEX REPLACE "-L" " " OMK_LIBDIR "${OMK_LIBDIR}")
ENDIF("${OMK_LDFLAGS}" MATCHES "${OMK_LIBDIR_EXTRACT_REGEX}")

#regex is all but '-' wich is the beginning of -l
SET(OMK_LIBS_EXTRACT_REGEX "[-][L]([ a-zA-Z0-9/.]*)")
IF("${OMK_LDFLAGS}" MATCHES "${OMK_LIBS_EXTRACT_REGEX}")
  STRING(REGEX REPLACE "${OMK_LIBS_EXTRACT_REGEX}" ""
    OMK_LIBS "${OMK_LDFLAGS}")
  STRING(REGEX REPLACE "-l" "" OMK_LIBS "${OMK_LIBS}")
ENDIF("${OMK_LDFLAGS}" MATCHES "${OMK_LIBS_EXTRACT_REGEX}")

Xavier Larrode a écrit :
> Hi all,
> i have a lib wich is working like fltk, as we can get the  link flags 
> and  link dir, and libraries used   with  "[lib]--config  --ldflags".
> So i have checked the FindFLTK.cmake and it seems to be done with regex.
>
> Does anyone has done the regex to extract separetly the --ldflags on  
> a libdir  var, lib-flags var and lib var ?
> Thanks
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Xavier.Larrode.vcf
Type: text/x-vcard
Size: 169 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20060823/0eaed2a3/Xavier.Larrode-0001.vcf


More information about the CMake mailing list