I have a CMake project that uses FindCurses.cmake. I am on OS X where the OS ships with an older version of ncurses (and doesn't appear to include the C++ bindings) and the code I'm trying to build requires ncurses 5.9. I've used homebrew to install 5.9, but like a good neighbor, homebrew doesn't overwrite the curses/ncurses resources that ship with the OS (nor do I want it to.)
My instinct is that this is something I ought to be able to do without editing the CMake files, right? (Because this change in behavior is specific to my build environment and isn't a change to the project itself, right?) With an autoconf project I would probably add CFLAGS and LDFLAGS environment variables before running ./configure, but CMake seems to have a lot more going on.
What's the idiomatic way to do this in CMake?
You can provide additional search paths through CMAKE_PREFIX_PATH.
Paths within CMAKE_PREFIX_PATH are searched first.
You can specify CMAKE_PREFIX_PATH either hardcoded in the CMakeLists.txt file or, preferably, through:
cmake -D CMAKE_PREFIX_PATH=/path/where/brew/installed/curses .
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