[CMake] Passing CMAKE_TOOLCHAIN_FILE on command line causes CMake warning

Pat Marion pat.marion at kitware.com
Wed Feb 6 08:34:17 EST 2013


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:


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


Most of these projects are not going to incorporate workarounds.  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.  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.

Pat



On Wed, Feb 6, 2013 at 10:51 PM, David Cole <dlrdave at aol.com> wrote:

> If you don't want to see the warning, then also pass in
> --no-warn-unused-cli on the command line.
>
>   --no-warn-unused-cli        = Don't warn about command line options.
>
> But that suppresses the warning for all unreferenced variables.
>
> Or... add:
>
>   message(STATUS "CMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}'")
>
> to the project's CMakeLists.txt file so the variable is always referenced.
>
> The point is: CMAKE_TOOLCHAIN_FILE is only read on the first configure.
> After that point, all toolchain stuff is cached and the file is unnecessary
> for subsequent configures.
>
> That bug should just be closed as "won't fix" because it's not a bug.
> It's the intended behavior, and there are multiple ways to avoid the
> legitimate warning.
>
>
> Just my opinion,
> D
>
>
>
>  -----Original Message-----
> From: Pat Marion <pat.marion at kitware.com>
> To: Michael Wild <themiwi at gmail.com>
> Cc: cmake <cmake at cmake.org>
> Sent: Wed, Feb 6, 2013 7:23 am
> Subject: Re: [CMake] Passing CMAKE_TOOLCHAIN_FILE on command line causes
> CMake warning
>
>  That'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?
>
> Pat
>
> On Wed, Feb 6, 2013 at 9:52 PM, Michael Wild <themiwi at gmail.com> wrote:
>
>> Hi
>>
>>
>>  On Wed, Feb 6, 2013 at 11:59 AM, Pat Marion <pat.marion at kitware.com>wrote:
>>
>>> Hi,
>>>
>>> I'm emailing about bug 13093<http://public.kitware.com/Bug/view.php?id=13093>in the backlog.  I found comments
>>> by Brad <http://www.cmake.org/pipermail/cmake/2011-February/042556.html>that suggest it's a legitimate warning, but I'm not sure how a project
>>> could avoid the warning.
>>
>>
>> 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.
>>
>> My 2c
>>
>> Michael
>>
>
>  --
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130206/156bd183/attachment.htm>


More information about the CMake mailing list