<div class="gmail_quote">On Mon, Oct 19, 2009 at 5:52 AM, Alexey Tkachenko <span dir="ltr"><<a href="mailto:alek.tkachenko@gmail.com">alek.tkachenko@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
I'm trying to search Boost with find_package as it's said in manual:<br>
# first I try to search boost in my folder<br>
find_package(Boost PATHS /path/to/my/libs NO_DEFAULT_PATH)<br>
#then I try to search in standard paths<br>
find_package(Boost)<br>
<br>
but cmake shoes warning message on first find_package:<br>
----------<br>
CMake Warning at CMakeLists.txt:41 (find_package):<br>
Could not find a configuration file for package Boost.<br>
<br>
Set Boost_DIR to the directory containing a CMake configuration file for<br>
Boost. The file will have one of the following names:<br>
<br>
BoostConfig.cmake<br>
boost-config.cmake<br>
---------<br>
<br>
How can I suppress search in standard paths? Thanks in advance for any help.<br></blockquote><div><br>You can set BOOST_ROOT which will cause FindBoost to search that path first, but it will still fallback to the standard paths. There is a bug for this in the tracker. I believe most people who use BOOST_ROOT simply rely on manual inspection to work around this potential problem.<br>
<br>NO_DEFAULT_PATH is not legal on a find_package() call which explains your problems above. To suppress the fallback behavior, you could add a conditional to FindBoost.cmake to include NO_DEFAULT_PATH anywhere there is a find_path() or find_library() call. E.g.<br>
<br>if(Boost_SET_NO_DEFAULT_PATH)<br> set(_boost_find_options NO_DEFAULT_PATH)<br>endif()<br>...<br>find_library(..... ${_boost_find_options} ...)<br><br>The only reason this hasn't been fixed is I keep wondering if we could just make FindBoost do this automatically if BOOST_ROOT is being used. But ultimately this will probably break some builds of people who rely on BOOST_ROOT as a "use it if it's there" feature so fixing it via a public conditional (defaulting off) is probably the only way to go.<br>
</div></div><br>-- <br>Philip Lowman<br>