|
Hi there, CMake 3.1 (both release candidates) now generate a CMP0054 warning when configuring the following CMakeLists.txt in a clean build folder with MSVC as the generator: cmake_minimum_required(VERSION 2.8)enable_language(ASM_MASM)The warning is: CMake Warning (dev) at E:/Program Files (x86)/CMake
3/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.I can see the file in question has been updated (presumably since RC2) to not quote the left-hand variables: http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeFindBinUtils.cmake;h=50cb9721272f98bc2ffe73e95ae57c3156251188;hb=HEAD but even with these updates, the quoted "MSVC" args generate the warning. I've attached a trivial patch removing all remaining instances of quoted "MSVC"s. Cheers, Fraser. |
From 9c0cd531876c60ad12e5df443bc3026a97a04404 Mon Sep 17 00:00:00 2001 From: Fraser Hutchison <[email protected]> Date: Tue, 18 Nov 2014 22:55:52 +0000 Subject: [PATCH] Removed quoted instances of MSVC to avoid generating warnings via CMP0054.
---
Modules/CMakeFindBinUtils.cmake | 10 +++++-----
Modules/Compiler/AppleClang-CXX.cmake | 2 +-
Modules/Compiler/Clang-CXX.cmake | 2 +-
Modules/Compiler/Clang.cmake | 4 ++--
Modules/Platform/Windows-Clang.cmake | 4 ++--
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 50cb972..d2991d2 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -30,11 +30,11 @@
# License text for the above reference.)
# if it's the MS C/CXX compiler, search for link
-if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
- OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"
- OR CMAKE_Fortran_SIMULATE_ID STREQUAL "MSVC"
- OR CMAKE_C_COMPILER_ID STREQUAL "MSVC"
- OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
+if(CMAKE_C_SIMULATE_ID STREQUAL MSVC
+ OR CMAKE_CXX_SIMULATE_ID STREQUAL MSVC
+ OR CMAKE_Fortran_SIMULATE_ID STREQUAL MSVC
+ OR CMAKE_C_COMPILER_ID STREQUAL MSVC
+ OR CMAKE_CXX_COMPILER_ID STREQUAL MSVC
OR (CMAKE_GENERATOR MATCHES "Visual Studio"
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
diff --git a/Modules/Compiler/AppleClang-CXX.cmake
b/Modules/Compiler/AppleClang-CXX.cmake
index 0372e18..0cabca4 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -1,6 +1,6 @@
include(Compiler/Clang)
__compiler_clang(CXX)
-if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN
"-fvisibility-inlines-hidden")
endif()
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 780a072..bc88405 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -1,7 +1,7 @@
include(Compiler/Clang)
__compiler_clang(CXX)
-if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN
"-fvisibility-inlines-hidden")
endif()
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index eeba119..b964fce 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -18,8 +18,8 @@ if(__COMPILER_CLANG)
endif()
set(__COMPILER_CLANG 1)
-if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
- OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+if(CMAKE_C_SIMULATE_ID STREQUAL MSVC
+ OR CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
macro(__compiler_clang lang)
endmacro()
else()
diff --git a/Modules/Platform/Windows-Clang.cmake
b/Modules/Platform/Windows-Clang.cmake
index 4c936fe..d37b969 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -18,8 +18,8 @@ if(__WINDOWS_CLANG)
endif()
set(__WINDOWS_CLANG 1)
-if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
- OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+if(CMAKE_C_SIMULATE_ID STREQUAL MSVC
+ OR CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
include(Platform/Windows-MSVC)
macro(__windows_compiler_clang lang)
__windows_compiler_msvc(${lang})
--
1.9.4.msysgit.1
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
