Thanks for the discussion guys!  And thanks Marcus for the CMAKE_CACHE_ARGS tip.  I&#39;ll try that out.<br><br><br>In fact, 
the current design could be problematic because if you *do* specify a 
different toolchain file, cmake will ignore it instead of sending you a warning like it does if you change the CMAKE_CXX_COMPILER.  Would it be straightforward to compare the passed in value of CMAKE_TOOLCHAIN_FILE against the cached version?  That would prevent the &quot;noisy&quot; warning message, and afford the opportunity to send a legitimate warning or error if it does not match. <br>


<br>Pat<br><br><div class="gmail_quote">On Wed, Feb 6, 2013 at 11:56 PM, David Cole <span dir="ltr">&lt;<a href="mailto:dlrdave@aol.com" target="_blank">dlrdave@aol.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<font color="black" face="arial">-----Original Message-----<br>

</font><div style="font-size:10pt;font-family:arial,helvetica"><font color="black" face="arial"><div><div class="h5"><font color="black" face="arial">
From: Pat Marion &lt;<a href="mailto:pat.marion@kitware.com" target="_blank">pat.marion@kitware.com</a>&gt;<br>

To: David Cole &lt;<a href="mailto:dlrdave@aol.com" target="_blank">dlrdave@aol.com</a>&gt;<br>

Cc: themiwi &lt;<a href="mailto:themiwi@gmail.com" target="_blank">themiwi@gmail.com</a>&gt;; cmake &lt;<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>&gt;<br>

Sent: Wed, Feb 6, 2013 8:34 am<br>

Subject: Re: [CMake] Passing CMAKE_TOOLCHAIN_FILE on command line causes CMake warning<br>

<br>








</font>
</div></div></font><div><font color="black" face="arial"></font><div><font color="black" face="arial"></font><div class="h5"><font color="black" face="arial"><font color="black" face="arial">

I&#39;d like you to try pasting the following text into a google search, so you can appreciate how widespread the warning is, 257 results from lots of different projects:<br>

<br>

<br>

CMake Warning:   Manually-specified variables were not used by the project:      CMAKE_TOOLCHAIN_FILE<br>



<br>

<br>

Most of these projects are not going to incorporate workarounds.  The warning is confusing to lots of users, and they&#39;re already unsure of the while crosscompiling thing, so seeing a warning adds uncertainty that they&#39;re doing it right.  Adding a workaround into the target project is not always possible since you might not have commit access or are compiling a previously released, stable version.<br>





<br>

Pat<br>

<br>

<br>

<br>


</font>
</font><div class="gmail_quote"><font color="black" face="arial"><font color="black" face="arial">On Wed, Feb 6, 2013 at 10:51 PM, David Cole <span dir="ltr">&lt;<a href="mailto:dlrdave@aol.com" target="_blank">dlrdave@aol.com</a>&gt;</span> wrote:<br>



</font></font><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font color="black" face="arial"><font color="black" face="arial">

<font color="black" face="arial">If you don&#39;t want to see the warning, then <font>also pass in --no-warn-unused-cl<font>i on the command line.<br>


<br>


</font><font>  --no-warn-unused-cli        = Don&#39;t warn about command line options.</font><br>


</font><font color="black" face="arial">

</font></font>
</font>
</font><div><font color="black" face="arial"><font color="black" face="arial"><font color="black" face="arial"><font color="black" face="arial"> <br>


<font>But that suppresses the warning <font>for all unreferenced variables.<br>


<br>


<font>Or... add<font>:<br>


<br>


</font>  message<font>(STATUS &quot;CMAKE_TOOLCHAIN<font>_FILE=&#39;${CMAKE_TOOLCHAIN_FILE}&#39;</font>&quot;)</font></font><br>


</font></font></font></font></font></font>
</div>







<div> <br>


<font>to the project<font>&#39;s CMakeLists.txt file so </font></font>the <font>v<font>ariable is always referenced.</font></font><br>



</div>







<div> <br>


<font>The point is: CMAKE_<font>TOOLCHAI<font>N_FILE is only read on the first configure. After that point, all toolchain stuff is cached and the file is unnecessary for subsequent configures.<br>


<br>


</font></font></font><font>That bu<font>g should just be closed as &quot;won<font>&#39;t fix&quot; because it&#39;s not a bug. It&#39;s the intended behavior, and there are multiple ways to avoid the legitimate warning.<br>






<br>


<br>


<font>Just my opinion,<br>


<font>D<br>


<br>


<br>


</font></font></font></font></font><br>



</div>







<div style="font-size:10pt;font-family:arial,helvetica">

<div>

<div>-----Original Message-----<br>



From: Pat Marion &lt;<a href="mailto:pat.marion@kitware.com" target="_blank">pat.marion@kitware.com</a>&gt;<br>



To: Michael Wild &lt;<a href="mailto:themiwi@gmail.com" target="_blank">themiwi@gmail.com</a>&gt;<br>



Cc: cmake &lt;<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>&gt;<br>



Sent: Wed, Feb 6, 2013 7:23 am<br>



Subject: Re: [CMake] Passing CMAKE_TOOLCHAIN_FILE on command line causes CMake warning<br>



<br>













<div>

That&#39;s a pretty messy workaround though, I think.  ExternalProject_Add passes in lots of variables, including ones that do not typically change, like CMAKE_CXX_COMPILER.  Why impose a special requirement on the CMAKE_TOOLCHAIN_FILE variable?  Would a patch to avoid the warning be a welcome change, or is there a reason the warning should remain?<br>









<br>



Pat<br>



<br>







<div class="gmail_quote">On Wed, Feb 6, 2013 at 9:52 PM, Michael Wild <span dir="ltr">&lt;<a href="mailto:themiwi@gmail.com" target="_blank">themiwi@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div dir="ltr">Hi<br>







<div class="gmail_extra"><br>



<br>







<div class="gmail_quote">



<div>On Wed, Feb 6, 2013 at 11:59 AM, Pat Marion <span dir="ltr">&lt;<a href="mailto:pat.marion@kitware.com" target="_blank">pat.marion@kitware.com</a>&gt;</span> wrote:<br>







<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>



<br>



I&#39;m emailing about <a href="http://public.kitware.com/Bug/view.php?id=13093" target="_blank">bug 13093</a> in the backlog.  I found <a href="http://www.cmake.org/pipermail/cmake/2011-February/042556.html" target="_blank">comments by Brad</a> that suggest it&#39;s a legitimate warning, but I&#39;m not sure how a project could avoid the warning.</blockquote>







</div>







<div><br>



By not specifying the toolchain file, for instance? If you have the problem in conjunction with ExternalProject_Add, check whether the CMakeCache.txt file exists in the build tree of the external project. If not, include the flag, otherwise drop it. <br>











<br>



My 2c<span><font color="#888888"><br>



<br>



Michael<br>



</font></span></div>



</div>



</div>



</div>




</blockquote></div>



<br>





</div>



 



</div>

</div>



<div style="font-size:12px;font-family:Tahoma,Verdana,Arial,Sans-Serif;margin:0px">

<pre style="font-size:9pt"><tt>--

Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>

Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a>
</tt></pre>
</div>



 



</div>



</blockquote></div>

<br>
<br>
</div></div><font>I appreciate the widesp<font>read nature of &quot;the problem.&quot; Re<font>ally, I do. (If you do the same sear<font>ch, but without CMAKE_TOOLCHAIN_FILE, you get 20,000+ results.)</font><br>
<br>
</font></font></font><font>The intent of the warning <font>feature is to point out that you may have <font>misspelled a vari<font>able name, since usually, variables specified on the command line *are* in fact, <font>referenced during the configure or generate steps.<br>


<br>
<font>Unfortunately, the text of the warning does not say &quot;you may have misspelled this, double-check your spelling&quot;. Nor does it say<font> the more clear &quot;this variable was no<font>t referenced at all by <font>any of t<font>he CMakeLists code use<font>d <font>during configuration or generation</font></font></font></font></font>&quot;. It could even say &quot;reference the v<font>ariable, or use --no<font>-warn-unused-cli<font> to eliminate this warning&quot; -- but it doesn&#39;t.</font></font></font></font><br>


<br>
<font>T<font>he other positive effect here is that it may point out that you&#39;re not using all the variables that you think you&#39;re using. Therefore, you may be able to simplify your command line, or your CMakeLists files.<br>


<br>
<br>
<font>I&#39;m not a big fan of special<font>-casing variable names for code like this. But if CMAKE_TOOLCHAIN_FILE is really &quot;special&quot;, then maybe that&#39;s the right <font>call here.</font> You could certainly check if it&#39;s the same as the cached value<font>, and only warn<font> if it&#39;s different. If you do add such <font>a warning, use text something like &quot;<font>start with a<font> completely clean<font> build tree if you are chan<font>ging toolchain files&quot; when a difference is detected.</font></font></font></font></font></font></font><br>


<br>
</font></font><br>
<font>Cheers,<br>
<font>D<br>
<br>
</font></font></font></font></font></font></font></font></font></font>


</div>

 



</div>

</blockquote></div><br>