Reputation: 8283
I am battling a "A required package was not found" error from cmake.
Let's say I have software foo that depends on the bar library.
And libbar.a
is installed in $HOME/lib
with bar.h
installed in $HOME/include
directory.
With automake tools, you typically can point the build system to bar by using:
$ cd foo
$ ./configure --with-bar=$HOME
But how can I achieve the same with the cmake tool?
I want cmake to be smart enough to not only look in /usr/lib
and /usr/local/lib
for a library, but also in my $HOME/lib
directory.
Upvotes: 1
Views: 254
Reputation: 19926
This is trivial:
$ cmake ... -DCMAKE_PREFIX_PATH=$HOME
If you want this to happen for bar
specifically, you can set bar_ROOT
instead.
See the documentation:
Semicolon-separated list of directories specifying installation prefixes to be searched by the
find_package()
,find_program()
,find_library()
,find_file()
, andfind_path()
commands. Each command will add appropriate subdirectories (likebin
,lib
, orinclude
) as specified in its own documentation.
https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html https://cmake.org/cmake/help/latest/variable/PackageName_ROOT.html
Upvotes: 1