Why cmake ignores the Boost_NO_BOOST_CMAKE environment variable?
<p>The following command works for me well:</p>

<pre><code>cmake ../ -DBoost_NO_BOOST_CMAKE=BOOL:ON
</code></pre>

<p>i.e., cmake ignores system <code>BoostConfig.cmake</code>, which is what I need. But if I try to do the same via an environment variable:</p>

<pre><code>Boost_NO_BOOST_CMAKE=ON cmake ../
</code></pre>

<p>cmake still reads <code>BoostConfig.cmake</code> and I got the following error:</p>

<pre><code>CMake Error at /usr/lib64/boost/BoostConfig.cmake:64 (get_target_property):
</code></pre>

<p>I've tried also setting to <code>TRUE</code>, <code>BOOL:ON</code>, etc. as well. Using cmake version 3.3.1. Any hint?</p>

<p><strong>UPDATE</strong></p>

<p>Adding</p>

<pre><code>set(Boost_NO_BOOST_CMAKE TRUE)
</code></pre>

<p>into <code>CMakeList.txt</code> works well, but the same line added into <code>PreLoad.cmake</code> does not. In the second case, running cmake with trace and debug options gives the following first few log lines:</p>

<pre><code>Configuring Debug su3-dense ...
Running with debug output on.
Running with trace output on.
/home/langr/projects/su3dense/PreLoad.cmake(1):  set(Boost_NO_BOOST_CMAKE TRUE )
/home/langr/projects/su3dense/CMakeLists.txt(1):  cmake_minimum_required(VERSION 3.0.0 )
...
</code></pre>

<p>So, the <code>PreLoad.cmake</code> file is apparently processed and the variable <code>Boost_NO_BOOST_CMAKE</code> is set. Why is this setting then ignored?</p>

<p><strong>UPDATE 2</strong></p>

<p>I finally got it working by writing </p>

<pre><code>set(Boost_NO_BOOST_CMAKE TRUE CACHE BOOL "" FORCE)
</code></pre>

<p>into <code>PreLoad.cmake</code>.</p>