<font color='black' size='2' face='arial'>-----Original Message-----<br>

<div style="font-family:arial,helvetica;font-size:10pt;color:black"><font color="black" face="arial" size="2">
From: Pat Marion &lt;pat.marion@kitware.com&gt;<br>

To: David Cole &lt;dlrdave@aol.com&gt;<br>

Cc: themiwi &lt;themiwi@gmail.com&gt;; cmake &lt;cmake@cmake.org&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 id="AOLMsgPart_1_964c3d50-993b-43d4-8e69-ead12844f93d"><font color="black" face="arial" size="2">

I'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:&nbsp;&nbsp; Manually-specified variables were not used by the project:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMAKE_TOOLCHAIN_FILE<br>



<br>

<br>

Most of these projects are not going to incorporate workarounds.&nbsp; The warning is confusing to lots of users, and they're already unsure of the while crosscompiling thing, so seeing a warning adds uncertainty that they're doing it right.&nbsp; 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>
<div class="gmail_quote"><font color="black" face="arial" size="2">On Wed, Feb 6, 2013 at 10:51 PM, David Cole <span dir="ltr">&lt;<a href="mailto:dlrdave@aol.com">dlrdave@aol.com</a>&gt;</span> wrote:<br>

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

<font color="black" face="arial">If you don'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>&nbsp; --no-warn-unused-cli&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = Don't warn about command line options.</font><br>


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

</font></font>
</font>
<div><font color="black" face="arial" size="2"><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>&nbsp; message<font>(STATUS "CMAKE_TOOLCHAIN<font>_FILE='${CMAKE_TOOLCHAIN_FILE}'</font>")</font></font><br>


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







<div> <br>


<font>to the project<font>'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 "won<font>'t fix" because it's not a bug. It'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 class="h5">-----Original Message-----<br>



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



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



Cc: cmake &lt;<a href="mailto:cmake@cmake.org">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's a pretty messy workaround though, I think.&nbsp; ExternalProject_Add passes in lots of variables, including ones that do not typically change, like CMAKE_CXX_COMPILER.&nbsp; Why impose a special requirement on the CMAKE_TOOLCHAIN_FILE variable?&nbsp; 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">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">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'm emailing about <a target="_blank" href="http://public.kitware.com/Bug/view.php?id=13093">bug 13093</a> in the backlog.&nbsp; I found <a target="_blank" href="http://www.cmake.org/pipermail/cmake/2011-February/042556.html">comments by Brad</a> that suggest it's a legitimate warning, but I'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 target="_blank" href="http://www.kitware.com">www.kitware.com</a>

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

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

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



 



</div>



</blockquote></div>

<br>
<br>
<font size="2">I appreciate the widesp<font size="2">read nature of "the problem." Re<font size="2">ally, I do. (If you do the same sear<font size="2">ch, but without CMAKE_TOOLCHAIN_FILE, you get 20,000+ results.)</font><br>
<br>
</font></font></font><font size="2">The intent of the warning <font size="2">feature is to point out that you may have <font size="2">misspelled a vari<font size="2">able name, since usually, variables specified on the command line *are* in fact, <font size="2">referenced during the configure or generate steps.<br>
<br>
<font size="2">Unfortunately, the text of the warning does not say "you may have misspelled this, double-check your spelling". Nor does it say<font size="2"> the more clear "this variable was no<font size="2">t referenced at all by <font size="2">any of t<font size="2">he CMakeLists code use<font size="2">d <font size="2">during configuration or generation</font></font></font></font></font>". It could even say "reference the v<font size="2">ariable, or use --no<font size="2">-warn-unused-cli<font size="2"> to eliminate this warning" -- but it doesn't.</font></font></font></font><br>
<br>
<font size="2">T<font size="2">he other positive effect here is that it may point out that you're not using all the variables that you think you're using. Therefore, you may be able to simplify your command line, or your CMakeLists files.<br>
<br>
<br>
<font size="2">I'm not a big fan of special<font size="2">-casing variable names for code like this. But if CMAKE_TOOLCHAIN_FILE is really "special", then maybe that's the right <font size="2">call here.</font> You could certainly check if it's the same as the cached value<font size="2">, and only warn<font size="2"> if it's different. If you do add such <font size="2">a warning, use text something like "<font size="2">start with a<font size="2"> completely clean<font size="2"> build tree if you are chan<font size="2">ging toolchain files" when a difference is detected.</font></font></font></font></font></font></font><br>
<br>
</font></font><br>
<font size="2">Cheers,<br>
<font size="2">D<br>
<br>
</font></font></font></font></font></font></font></font></font></font>


</div>

 <!-- end of AOLMsgPart_1_964c3d50-993b-43d4-8e69-ead12844f93d -->



</div>

</font>