10

I have third party cmake project that depends on gnu readline library. So I installed readline by brew install readline. The problem is, readline is a keg-only formula and cmake tries to link it against libedit which shadows libreadline but it lacks some functionalities.

My question is, how can I force cmake to prefer brew version of this library over the system library?

Also, since this would be a osx only problem, it would be great if solution can be applied via command line (instead of changing CMakeList.txt).

Community
  • 1
  • 1
Pouya
  • 1,266
  • 3
  • 18
  • 44

1 Answers1

1

Excerpt from brew info readline:

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

CMake uses pkg-config for finding a library, so the second paragraph should apply.

equal-l2
  • 899
  • 7
  • 17