On Mon, Oct 19, 2009 at 5:52 AM, Alexey Tkachenko
<[email protected]>wrote:
> Hi,
> I'm trying to search Boost with find_package as it's said in manual:
> # first I try to search boost in my folder
> find_package(Boost PATHS /path/to/my/libs NO_DEFAULT_PATH)
> #then I try to search in standard paths
> find_package(Boost)
>
> but cmake shoes warning message on first find_package:
> ----------
> CMake Warning at CMakeLists.txt:41 (find_package):
> Could not find a configuration file for package Boost.
>
> Set Boost_DIR to the directory containing a CMake configuration file for
> Boost. The file will have one of the following names:
>
> BoostConfig.cmake
> boost-config.cmake
> ---------
>
> How can I suppress search in standard paths? Thanks in advance for any
> help.
>
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.
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.
if(Boost_SET_NO_DEFAULT_PATH)
set(_boost_find_options NO_DEFAULT_PATH)
endif()
...
find_library(..... ${_boost_find_options} ...)
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.
--
Philip Lowman
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake