[CMake] Tell cmake use /usr/include/db.h, not /usr/local/include/db.h

Larry Hynes larry at larryhynes.com
Sun Jul 9 07:16:08 EDT 2017


Hi

I'm building nvi2[0], on (Mac OS X Yosemite (10.10.5)), which uses
cmake.

nvi2 depends on a reasonably sane BSD environment, which would
include Berkeley DB V1 which is found at /usr/include/db.h.

I also have installed BDB V4, which lives at /usr/local/include/db.h,
for use by other programs.

The only way I can get nvi2 to build, is to uninstall BDB V4, in
which case cmake picks up V1 and all is well. Otherwise cmake
resolutely picks up V4 and the build fails.

I'm trying to figure out if it is possible to tell cmake to use the
V1 that is at /usr/include/db.h.

I've tried various invocations of find_path and find_library in
CMakeLists.txt, with and without appeals to default paths and such
like, to no avail. I've tried any variation of -DCMAKE_XXXFLAGS I
can think of, in CMakeLists.txt and on the command line, to no
avail. (When using find_XXX, cmake tells me they're found, but still
uses DB4. In the case of passing flags, cmake tells me that it
is ignoring them.)

Now, at day's end, this is not A Big Deal; I uninstall BDB4, build
nvi2, reinstall BDB4. But one would imagine that there is some
(simple) way to instruct cmake to use X over Y when building Z?

[0] https://github.com/lichray/nvi2



More information about the CMake mailing list