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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With