User forums > General (but related to Code::Blocks)

Inporting Compiler, linker and defines from pkgconfig for a project

(1/1)

aditya_v:
How to accomplish this?
For eg:
I wanted to make a glfw application. Now, glfw defines a libglfw.pc file which has all the necessary, to make a app run. However, i need to manually specify the path to its libs, and headers.
Even then, the default glfw project template doesn't include libraries X11 Xrandr m, which i needed to add manually after looking at libglfw.pc. It also defines -D_REENTRANT which i don't know how to add to the project builder script.

I would really like to know how to get sensitive settings like these from pkgconfig directly.

Jenna:
You can use the appropriate pkg-config call in the projects build-options ("Compiler settings -> Other options" for the includes and cppflags and "Linker settings -> Other linker settiings" for the libs).
Just add them included in backticks "`" and they will be automatically expanded by the C::B build-system.

To see how it works, you can have a look at a wizard-created wxWidgets project.

Example for gtk+-2.0:


--- Code: ---`pkg-config --cflags gtk+-2.0`
--- End code ---
and

--- Code: ---`pkg-config --libs gtk+-2.0`
--- End code ---

aditya_v:
Thanks.I figured that part out.  :)

However, I was asking if it is possible to add these in the wizard generation template. I don't want todo it all the time.

Navigation

[0] Message Index

Go to full version