<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri, sans-serif" size="2">
<div>I&#8217;m curious if the behavior I&#8217;m seeing with respect to FindBoost.cmake is expected.&nbsp; (I realize I&#8217;m using these macros in a convoluted way, so understand if I can&#8217;t make it work more cleanly.)&nbsp; </div>
<div>&nbsp;</div>
<div>What I&#8217;d like to be able to do is something like the following to probe for a system-provided or user-specified Boost, but then fall back on a distributed one that comes with our software as needed (probably in config instead of module mode, but that&#8217;s
for another day):</div>
<div>&nbsp;</div>
<div>find_package(Boost 1.40)</div>
<div>if (NOT Boost_FOUND)</div>
<div>&nbsp; set(BOOST_ROOT /path/to/boost/in/our/tree)</div>
<div>&nbsp; find_package(Boost 1.40 REQUIRED)</div>
<div>endif()</div>
<div>&nbsp;</div>
<div>I get problems with this, e.g., on RHEL5, which has Boost 1.33 installed.&nbsp; The first find fails due to version too low, then the second find doesn&#8217;t probe because it detects Boost settings in the cache.&nbsp; After the first probe (and in the end) Boost_FOUND
is false, AND the include and lib dirs for Boost are set to the 1.33 install location, which is misleading.&nbsp; It seems odd to me that these variables get set even though the probe failed.</div>
<div>&nbsp;</div>
<div>I can perform a workaround where I trick FindBoost.cmake to not use the cache:</div>
<div>&nbsp;</div>
<div>find_package(Boost 1.40)</div>
<div>if (NOT Boost_FOUND)</div>
<div>&nbsp; unset(Boost_INCLUDE_DIR CACHE)</div>
<div>&nbsp; # these not needed, but could do to be safe:</div>
<div>&nbsp; #unset(Boost_LIBRARY_DIRS CACHE)</div>
<div>&nbsp; #unset(Boost_LIB_VERSION CACHE)</div>
<div>&nbsp; #unset(Boost_VERSION CACHE)</div>
<div>&nbsp; set(BOOST_ROOT /path/to/boost/in/our/tree)</div>
<div>&nbsp; find_package(Boost 1.40)</div>
<div>endif()</div>
<div>&nbsp;</div>
<div>Then I end up with the 1.40 that I&#8217;d expect.&nbsp; This seems likely to bite me down the road.&nbsp; How (besides requiring the user to have sufficiently new Boost on their system), should I handle this?</div>
<div>&nbsp;</div>
<div>Thanks,</div>
<div>Brian</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
</font>
</body>
</html>