aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-11-14 22:33:14 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-11-19 11:35:15 +0100
commitfba9f41b84cc591f124cef7d796321cfa000fc8c (patch)
treee3d38da14bbde8dbd27b5d1b9ea14cebe0a6302d
parent54fc885efd3a86874c101b28c1744f7692589daf (diff)
CMake: Simplify if() conditions on check result variables
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(DEFINED) instead. This also avoids warnings for CMake Policy CMP0054 in CMake 3.1.
-rw-r--r--CMake/Macros.cmake8
1 files changed, 4 insertions, 4 deletions
diff --git a/CMake/Macros.cmake b/CMake/Macros.cmake
index df15b7406..dab005f73 100644
--- a/CMake/Macros.cmake
+++ b/CMake/Macros.cmake
@@ -27,7 +27,7 @@ endmacro(CHECK_INCLUDE_FILE_CONCAT)
# For other curl specific tests, use this macro.
macro(CURL_INTERNAL_TEST CURL_TEST)
- if("${CURL_TEST}" MATCHES "^${CURL_TEST}$")
+ if(NOT DEFINED "${CURL_TEST}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${CURL_TEST} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
@@ -55,11 +55,11 @@ macro(CURL_INTERNAL_TEST CURL_TEST)
"Performing Curl Test ${CURL_TEST} failed with the following output:\n"
"${OUTPUT}\n")
endif(${CURL_TEST})
- endif("${CURL_TEST}" MATCHES "^${CURL_TEST}$")
+ endif()
endmacro(CURL_INTERNAL_TEST)
macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
- if("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$")
+ if(NOT DEFINED "${CURL_TEST}_COMPILE")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
@@ -91,5 +91,5 @@ macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
"\n\n")
endif(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST})
- endif("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$")
+ endif()
endmacro(CURL_INTERNAL_TEST_RUN)