[CMake] How to handle generated arguments list in CMake

Philip Lowman philip at yhbt.com
Sat Jul 18 02:35:12 EDT 2009


You probably want to use the execute_process() on "llvm-config --cppflags",
then "llvm-config --ldflags", etc. and store each into a variable using a
regular expression if necessary to parse the output.  From there you can
call include_directories(), add_definitions(), and target_link_libraries()
as needed.

You might be able to adapt FindPkgConfig.cmake for your purposes (having it
call llvm-config instead)?
You might also have a look at FindXMLRPC.cmake as it does similar parsing to
what you would need.

This assumes that you want CMake to work with the output of any
llvm-config.  If you don't need this level of detail you can probably cut
corners just to get it working.

On Sat, Jul 18, 2009 at 1:11 AM, Carter Cheng <carter_cheng at yahoo.com>wrote:

> Hi,
>
> I am having some difficulties determining how to work with a back quoted
> arguments generator using CMake. I.e. something like this-
>
> g++ -g -c Exp.cpp `llvm-config --cppflags --ldflags --libs core jit native`
>
> Any advice/tips would be appreciated.
>
> Thanks in advance,
>
> Carter.
>
>
>
> _______________________________________________
> 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
>



-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090718/0be797ea/attachment.htm>


More information about the CMake mailing list