Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding /usr/local/bin (homebrew) to QtCreator search path for pkg-config on Mac OSX

Setup

  • Using Qt Creator on Mac OSX mountain lion.
  • Installed packages in /usr/local using homebrew.
  • /usr/local/bin/pkg-config exists.
  • Want to use pkgconfig through the project file

-

QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
PKGCONFIG += protobuf #Or whatever package you want to try.
  • /usr/local/bin being in the path, when I run /Applications/Other/Qt5.0.2/5.0.2/clang_64/bin/qmake myproject.pro It runs fine.
  • When I try to build the project through Qt Creator I see the error sh: pkg-config: command not found and the build fails.
  • I already tried launchctl setenv PATH $PATH as suggested in Environment variables in Mac OS X

Does anyone have any idea how to make this work?

like image 303
Spundun Avatar asked Jun 16 '13 01:06

Spundun


Video Answer


1 Answers

The way I have done it so far is, in the qmake project file I hardcoded the pkgconfig path

mac {
  PKG_CONFIG = /usr/local/bin/pkg-config
}

I'm hoping there's a more elegant solution that someone can provide.

like image 163
Spundun Avatar answered Oct 03 '22 12:10

Spundun