Use NEW behavior for policy CMP0054.

The NEW behavior is to not dereference variables or interpret keywords
that have been quoted or bracketed.

For more information, see
https://cmake.org/cmake/help/v3.1/policy/CMP0054.html.

This is to suppress a warning when using CMake 3.1.3+.
This commit is contained in:
Lei Zhang 2016-08-07 22:49:00 -04:00
parent 816f29805b
commit 190b0d3162
2 changed files with 9 additions and 2 deletions

View File

@ -25,6 +25,13 @@
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
cmake_minimum_required(VERSION 2.8.12)
if (POLICY CMP0054)
# Avoid dereferencing variables or interpret keywords that have been
# quoted or bracketed.
# https://cmake.org/cmake/help/v3.1/policy/CMP0054.html
cmake_policy(SET CMP0054 NEW)
endif()
project(spirv-tools)
enable_testing()
set(SPIRV_TOOLS "SPIRV-Tools")
@ -49,7 +56,7 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
endif()
option(SPIRV_WERROR "Enable error on warning" ON)
if((${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") OR (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang"))
if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
set(COMPILER_IS_LIKE_GNU TRUE)
endif()
if(${COMPILER_IS_LIKE_GNU})

View File

@ -51,7 +51,7 @@ function(add_spvtools_unittest)
if(${COMPILER_IS_LIKE_GNU})
target_compile_options(${ARG_TARGET} PRIVATE -Wno-undef)
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Disable C4503 "decorated name length exceeded" warning,
# triggered by some heavily templated types.
# We don't care much about that in test code.