How to handle generated arguments list in CMake

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to handle generated arguments list in CMake

Carter Cheng
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
Reply | Threaded
Open this post in threaded view
|

Re: How to handle generated arguments list in CMake

Philip Lowman
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 <[hidden email]> 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

_______________________________________________
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