[CMake] Unclear warning

Nils Gladitz nilsgladitz at gmail.com
Tue Dec 9 02:56:45 EST 2014


On 12/09/2014 08:30 AM, Micha Renner wrote:
> Hi,
>
> what does this message mean?
>
> The ASM_MASM compiler identification is MSVC
> CMake Warning (dev) at C:/Program
> Files/CMake/share/cmake-3.1/Modules/CMakeFindBinUtils.cmake:33 (if):
>    Policy CMP0054 is not set: Only interpret if() arguments as variables
> or
> keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
> details.  Use the cmake_policy command to set the policy and suppress
> this
>    warning.
>
>    Quoted variables like "MSVC" will no longer be dereferenced when the
> policy
>    is set to NEW.  Since the policy is not set the OLD behavior
> will be used.
> Call Stack (most recent call first):
>    C:/Program
> Files/CMake/share/cmake-3.1/Modules/CMakeDetermineASMCompiler.cmake:137
> (include)
>    C:/Program
> Files/CMake/share/cmake-3.1/Modules/CMakeDetermineASM_MASMCompiler.cmake:27 (include)
>    src/CMakeLists.txt:44 (ENABLE_LANGUAGE)
>
> Is this a wanted warning?

The warning is due to an ambiguity of if() argument evaluation in an 
internal module (CMakeFindBinUtils.cmake).

Assuming CMAKE_C_COMPILER_ID is MSVC and MSVC is 1 the following expression:
   if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")

With OLD CMP0054 behavior is basically the same as:
   if(1 STREQUAL 1)

with NEW CMP0054 policy behavior quoted arguments are protected from 
implicit expansion so the same conditional boils down to:
   if("MSVC" STREQUAL "MSVC")

The warning was fixed in 
http://www.cmake.org/gitweb?p=stage/cmake.git;a=commit;h=4d52cd36 .

The fix should also be in the upcoming rc3.

Nils



More information about the CMake mailing list