Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: ppanish on July 13, 2012, 11:07:43 pm

Title: How to set up compiler/linker settings from a file or command
Post by: ppanish on July 13, 2012, 11:07:43 pm
What's the best way to include a large list of command line options (say from a file) in a project build?

For example, in a command line where I would normally use `pkg-config --cflags --libs lib_name`as part of the compiler command line options. Is there a way to use the command directly, or alternatively to include a file with the include and library paths that's been generated with such a command?

I've added these line by line in the Project Build Options linker settings and search directories, but this is fairly painful and I suspect there's a better way to do it.
Title: Re: How to set up compiler/linker settings from a file or command
Post by: Jenna on July 13, 2012, 11:58:51 pm
Backtick expanding is supported by C::B on all platforms, so it should work out of the box.

You have to split the command in the compiler and the linker part and put it in the appropriate section of the projects build options: "Compiler options -> Other options" and "Linker settings -> Other linker options", because C::B does compiling and linking always in two steps.
Title: Re: How to set up compiler/linker settings from a file or command
Post by: ppanish on July 14, 2012, 02:35:24 pm
Thanks for the hint, it worked perfectly.