Reputation: 39
Suppose your project has multiple authors and depends on some libraries that must be installed on your system - you don't ship them with the project.
Some people have installed that libraries in /usr
, /usr/local/
, /opt
or /opt/local
.
What is the best practice to add them to the include path, without messing up CMakeLists.txt
with all possible paths?
I am aware of xxx_ROOT
variables like BOOST_ROOT
, but not all library detections based on such a variable.
Upvotes: 2
Views: 904
Reputation: 23461
Teach your users / co-authors to use custom CMAKE_PREFIX_PATH
which they can pass to their CMake call:
cmake -DCMAKE_PREFIX_PATH=/opt/local;/home/brandstifter/boost-1.70/ ..
For each find command, CMake will also search within the paths from CMAKE_PREFIX_PATH
. See its documentation.
Upvotes: 1