On Saturday 26 September 2009, Christian Ehrlicher wrote:
> Hi,
>
> I get this warning:
>
> -----------------8<----------------------
> CMake Warning (dev) at cmake/modules/FindQt4.cmake:826 (SET):

That's the FindQt4.cmake from kdelibs, right ?
Current trunk ?

>   Local variable "QT4_QTUITOOLS_LIBRARY" is set to
>
>
> optimized;D:/kde/kde-msvc/lib/QtUiTools.lib;debug;D:/kde/kde-msvc/lib/QtUiT
>o olsd.lib
>
>   but the CACHE entry of the same name is set to
>
>     D:/kde/kde-msvc/lib/QtUiTools.lib
>
>   The local variable is hiding the cache value.
>
>   Policy CMP0015 is not set: The set() CACHE mode and option() command make
>   the cache value visible.  Run "cmake --help-policy CMP0015" for policy
>   details.  Use the cmake_policy command to set the policy and suppress
> this warning.
> Call Stack (most recent call first):
>   cmake/modules/FindQt4.cmake:859 (_QT4_ADJUST_LIB_VARS)
>   cmake/modules/MacroOptionalFindPackage.cmake:19 (FIND_PACKAGE)
>   CMakeLists.txt:52 (macro_optional_find_package)
> This warning is for project developers.  Use -Wno-dev to suppress it.
> -----------------8<----------------------
>
>
> Whats wrong here?

With cmake < 2.8.0 

set(FOO foo)
message("FOO 1: ${FOO}")
set(FOO bar ... CACHE)
message("FOO 2: ${FOO}")

produced on the initial cmake run:
FOO 1: foo
FOO 2: bar

and on all cmake runs afterwards:
FOO 1: foo
FOO 2: foo

i.e. the value of FOO in the cache was hidden by the value of the local FOO. 
This was probably not really the expected behaviour.
With cmake 2.8.0 it warns when this happens.

What we do in kdelibs/cmake/modules/FindQt4.cmake is that we do
find_library(QT_QTUITOOLS_LIBRARY ...)
and then later on in _QT4_ADJUST_LIB_VARS() we do 
set(QT_QTUITOOLS_LIBRARY ...RELEASE ... DEBUG)
and finally again:

SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE FILEPATH "The Qt 
${basename} library")

The purpose of the last one was to get that value into the cache, but that did 
not work (since there was already a value in the cache, so that set(CACHE) 
didn't change anything. 
Now cmake warns us about that, this is good.
We (I ?) should fix this in kdelibs, probably sync more or less to the 
FindQt4.cmake from cmake.

Alex
_______________________________________________
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

Reply via email to