Author Topic: Inporting Compiler, linker and defines from pkgconfig for a project  (Read 2633 times)

Offline aditya_v

  • Single posting newcomer
  • *
  • Posts: 9
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.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Inporting Compiler, linker and defines from pkgconfig for a project
« Reply #1 on: June 26, 2009, 02:47:26 pm »
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: [Select]
`pkg-config --cflags gtk+-2.0`and
Code: [Select]
`pkg-config --libs gtk+-2.0`

Offline aditya_v

  • Single posting newcomer
  • *
  • Posts: 9
Re: Inporting Compiler, linker and defines from pkgconfig for a project
« Reply #2 on: June 26, 2009, 03:56:55 pm »
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.