2025-07-31 21:14 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002045Spring engineGeneralpublic2010-12-20 17:21
ReporterjK 
Assigned Tohoijui 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0002045: cmake 2.8 gives warning about 7zip_FIND_QUIETLY (starting with a number)
Descriptionsee title
Additional InformationCMake Warning (dev) at C:/MinGW32/cmake/share/cmake-2.8/Modules/FindPackageMessage.cmake:36 (IF):
  given arguments:

    "NOT" "7zip_FIND_QUIETLY"

  An argument named "7zip_FIND_QUIETLY" appears in a conditional statement.
  Policy CMP0012 is not set: if() recognizes numbers and boolean constants.
  Run "cmake --help-policy CMP0012" for policy details. Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  C:/MinGW32/cmake/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:67 (FIND_PACKAGE_MESSAGE)
  rts/build/cmake/Find7zip.cmake:26 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:206 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0005321

hoijui (reporter)

Last edited: 2010-08-20 08:55

yeah.. i know that.
thing is, that this var name is standardized, built out of the package name.
so the only solution would be, to rename the whole package, from eg. 7zip to SevenZip. Quite ugly in my eyes, but well... guess theres no other/nicer solution. Kind of bad we have to do that just for a warning.

would mean:
FindSevenZip.cmake
Find_Package(SevenZip)
${SevenZip_BIN}
...

~0005328

jK (developer)

hmm expected something like that when I took a look at the code

Perhaps there is a way to hide this warning then?

~0005331

hoijui (reporter)

$ cmake --help-policy CMP0012
cmake version 2.8.1
  CMP0012
       if() recognizes numbers and boolean constants.

       In CMake versions 2.6.4 and lower the if() command implicitly
       dereferenced arguments corresponding to variables, even those named
       like numbers or boolean constants, except for 0 and 1. Numbers and
       boolean constants such as true, false, yes, no, on, off, y, n,
       notfound, ignore (all case insensitive) were recognized in some cases
       but not all. For example, the code "if(TRUE)" might have evaluated as
       false. Numbers such as 2 were recognized only in boolean expressions
       like "if(NOT 2)" (leading to false) but not as a single-argument like
       "if(2)" (also leading to false). Later versions of CMake prefer to
       treat numbers and boolean constants literally, so they should not be
       used as variable names.

       The OLD behavior for this policy is to implicitly dereference
       variables named like numbers and boolean constants. The NEW behavior
       for this policy is to recognize numbers and boolean constants without
       dereferencing variables with such names.

       This policy was introduced in CMake version 2.8.0. CMake version
       2.8.1 warns when the policy is not set and uses OLD behavior. Use the
       cmake_policy command to set it to OLD or NEW explicitly.



To me, this sounds like what we see here is actually a bug in CMake. The never talk about stings starting with a number, but only about numbers, and as there is no Hex support or other fancy stuff in CMake, i can not see why they should try to interpret "7zip" as a number.

to prevent the warning, we have two options:

# sets all policies to OLD / CMake 2.6.4 defaults
# this is recommended by CMake
cmake_policy(VERSION 2.6.4)

# set only this one policy
cmake_policy(SET CMP0012 OLD)

i guess the recommend the first one, cause this way you will stay compatible with 2.6 automatically. i guess it is the better option for us indeed, cause 2.6 is still very common, and there is no feature in 2.8 that would be useful for us.

~0006108

abma (administrator)

fixed by this? https://github.com/spring/spring/commit/e7245f0dbacd7efdc7f091c683761c11cc88a63b

~0006110

hoijui (reporter)

yes, thanks!
+Notes

-Issue History
Date Modified Username Field Change
2010-08-19 03:17 jK New Issue
2010-08-19 19:21 hoijui Note Added: 0005321
2010-08-20 05:32 jK Note Added: 0005328
2010-08-20 08:55 hoijui Note Edited: 0005321
2010-08-20 09:06 hoijui Note Added: 0005331
2010-12-20 09:28 abma Note Added: 0006108
2010-12-20 17:21 hoijui Note Added: 0006110
2010-12-20 17:21 hoijui Status new => resolved
2010-12-20 17:21 hoijui Resolution open => fixed
2010-12-20 17:21 hoijui Assigned To => hoijui
+Issue History