Fix cmake warnings
authorBoris Zanin <boris.zanin@mobica.com>
Mon, 12 Jun 2017 07:05:47 +0000 (09:05 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 28 Aug 2017 09:14:40 +0000 (05:14 -0400)
Running cmake command under Windows as

cmake -G "Visual Studio 12 Win64" /path/to/vk-gl-cts

or

cmake /path/to/vk-gl-cts

there are policy warnings CMP0054 stating:
"Only interpret if() arguments as variables or keywords when unquoted"

Fix: remove unnecessary quoting at complaining lines.
Also do not use dereferencing (i.e. ${var}) on variable due to cmake
does dereferencing automatically on variables in if statement. Good
explanation is at https://stackoverflow.com/questions/25809332/

Components: Framework

VK-GL-CTS issue: 492

Change-Id: I5258f4a5145588efb34ba2356ba25004277f9213

framework/delibs/cmake/Defs.cmake

index d40bd73..e65015b 100644 (file)
@@ -68,21 +68,19 @@ DE_MAKE_ENV_BOOL("DE_OS" "ANDROID")
 DE_MAKE_ENV_BOOL("DE_OS" "IOS")
 
 # Prevent mixed compile with GCC and Clang
-if (NOT ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") EQUAL ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))
+if (NOT (CMAKE_C_COMPILER_ID MATCHES "GNU") EQUAL (CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
        message(FATAL_ERROR "CMake C and CXX compilers do not match. Both or neither must be GNU.")
-elseif (NOT ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") EQUAL ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
+elseif (NOT (CMAKE_C_COMPILER_ID MATCHES "Clang") EQUAL (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
        message(FATAL_ERROR "CMake C and CXX compilers do not match. Both or neither must be Clang.")
 endif ()
 
 # Compiler detection
 if (NOT DEFINED DE_COMPILER)
-       # \note " x" postfix is to work around bug in CMake that causes
-       #       "MSVC" to translate to something completely different
-       if (("${CMAKE_C_COMPILER_ID} x" MATCHES "MSVC") OR MSVC)
+       if ((CMAKE_C_COMPILER_ID MATCHES "MSVC") OR MSVC)
                set(DE_COMPILER "DE_COMPILER_MSC")
-       elseif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+       elseif (CMAKE_C_COMPILER_ID MATCHES "GNU")
                set(DE_COMPILER "DE_COMPILER_GCC")
-       elseif ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
+       elseif (CMAKE_C_COMPILER_ID MATCHES "Clang")
                set(DE_COMPILER "DE_COMPILER_CLANG")
 
        # Guess based on OS