简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM