From e6c956d1131eedf3f0f7365f718ddedb289fa1a9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 23 Jan 2015 05:27:11 -0500 Subject: [PATCH] Simplify if() conditions on check result variables to fix CMP0054 warning Remove use of an old hack that takes advantage of the auto-dereference behavior of the if() command to detect if a variable is defined. The hack has the form: if("${VAR} MATCHES "^${VAR}$") where "${VAR}" is a macro argument reference. Use if(NOT DEFINED) instead. This also avoids warnings for CMake Policy CMP0054. --- CMake/OpenIGTLinkCMakeTests.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMake/OpenIGTLinkCMakeTests.cmake b/CMake/OpenIGTLinkCMakeTests.cmake index 54447444..a42159ea 100644 --- a/CMake/OpenIGTLinkCMakeTests.cmake +++ b/CMake/OpenIGTLinkCMakeTests.cmake @@ -5,7 +5,7 @@ INCLUDE(CheckFunctionExists) CHECK_LIBRARY_EXISTS("socket" getsockname "" OpenIGTLink_HAVE_LIBSOCKET) -IF("OpenIGTLink_HAVE_GETSOCKNAME_WITH_SOCKLEN_T" MATCHES "^OpenIGTLink_HAVE_GETSOCKNAME_WITH_SOCKLEN_T$") +IF(NOT DEFINED "OpenIGTLink_HAVE_GETSOCKNAME_WITH_SOCKLEN_T") IF(OpenIGTLink_HAVE_LIBSOCKET) SET(OpenIGTLink_GETSOCKNAME_LIBS "socket") ELSE(OpenIGTLink_HAVE_LIBSOCKET) @@ -32,7 +32,7 @@ IF("OpenIGTLink_HAVE_GETSOCKNAME_WITH_SOCKLEN_T" MATCHES "^OpenIGTLink_HAVE_GETS "failed with the following output:\n" "${OUTPUT}\n" APPEND) ENDIF(OpenIGTLink_HAVE_GETSOCKNAME_WITH_SOCKLEN_T) -ENDIF("OpenIGTLink_HAVE_GETSOCKNAME_WITH_SOCKLEN_T" MATCHES "^OpenIGTLink_HAVE_GETSOCKNAME_WITH_SOCKLEN_T$") +ENDIF(NOT DEFINED "OpenIGTLink_HAVE_GETSOCKNAME_WITH_SOCKLEN_T") # e.g. Mac OS X Snow Leopard does not have strnlen().