summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
Diffstat (limited to 'CMake')
-rw-r--r--CMake/CurlSymbolHiding.cmake8
-rw-r--r--CMake/FindCARES.cmake26
-rw-r--r--CMake/FindLibSSH2.cmake29
-rw-r--r--CMake/FindNGHTTP2.cmake4
-rw-r--r--CMake/FindNSS.cmake4
-rw-r--r--CMake/OtherTests.cmake4
-rw-r--r--CMake/Utilities.cmake5
7 files changed, 22 insertions, 58 deletions
diff --git a/CMake/CurlSymbolHiding.cmake b/CMake/CurlSymbolHiding.cmake
index 224755a31..8e5fd67a0 100644
--- a/CMake/CurlSymbolHiding.cmake
+++ b/CMake/CurlSymbolHiding.cmake
@@ -11,13 +11,7 @@ if(CURL_HIDDEN_SYMBOLS)
set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))")
set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
elseif(CMAKE_COMPILER_IS_GNUCC)
- if(NOT CMAKE_VERSION VERSION_LESS 2.8.10)
- set(GCC_VERSION ${CMAKE_C_COMPILER_VERSION})
- else()
- execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
- OUTPUT_VARIABLE GCC_VERSION)
- endif()
- if(NOT GCC_VERSION VERSION_LESS 3.4)
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
# note: this is considered buggy prior to 4.0 but the autotools don't care, so let's ignore that fact
set(SUPPORTS_SYMBOL_HIDING TRUE)
set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))")
diff --git a/CMake/FindCARES.cmake b/CMake/FindCARES.cmake
index 723044a64..3d1bae6dc 100644
--- a/CMake/FindCARES.cmake
+++ b/CMake/FindCARES.cmake
@@ -7,34 +7,16 @@
# also defined, but not for general use are
# CARES_LIBRARY, where to find the c-ares library.
-find_path(CARES_INCLUDE_DIR ares.h
- /usr/local/include
- /usr/include
- )
+find_path(CARES_INCLUDE_DIR ares.h)
set(CARES_NAMES ${CARES_NAMES} cares)
find_library(CARES_LIBRARY
NAMES ${CARES_NAMES}
- PATHS /usr/lib /usr/local/lib
)
-if(CARES_LIBRARY AND CARES_INCLUDE_DIR)
- set(CARES_LIBRARIES ${CARES_LIBRARY})
- set(CARES_FOUND "YES")
-else()
- set(CARES_FOUND "NO")
-endif()
-
-
-if(CARES_FOUND)
- if(NOT CARES_FIND_QUIETLY)
- message(STATUS "Found c-ares: ${CARES_LIBRARIES}")
- endif()
-else()
- if(CARES_FIND_REQUIRED)
- message(FATAL_ERROR "Could not find c-ares library")
- endif()
-endif()
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CARES
+ REQUIRED_VARS CARES_LIBRARY CARES_INCLUDE_DIR)
mark_as_advanced(
CARES_LIBRARY
diff --git a/CMake/FindLibSSH2.cmake b/CMake/FindLibSSH2.cmake
index 0d6219425..91e17c1db 100644
--- a/CMake/FindLibSSH2.cmake
+++ b/CMake/FindLibSSH2.cmake
@@ -5,31 +5,18 @@
# LIBSSH2_INCLUDE_DIR - the libssh2 include directory
# LIBSSH2_LIBRARY - the libssh2 library name
-if(LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
- set(LibSSH2_FIND_QUIETLY TRUE)
-endif()
-
-find_path(LIBSSH2_INCLUDE_DIR libssh2.h
-)
+find_path(LIBSSH2_INCLUDE_DIR libssh2.h)
-find_library(LIBSSH2_LIBRARY NAMES ssh2 libssh2
-)
+find_library(LIBSSH2_LIBRARY NAMES ssh2 libssh2)
if(LIBSSH2_INCLUDE_DIR)
- file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*")
-
- string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MAJOR "${libssh2_version_str}")
- string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MINOR "${libssh2_version_str}")
- string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_PATCH "${libssh2_version_str}")
-
- string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MAJOR "${LIBSSH2_VERSION_MAJOR}")
- string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MINOR "${LIBSSH2_VERSION_MINOR}")
- string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_PATCH "${LIBSSH2_VERSION_PATCH}")
-
- set(LIBSSH2_VERSION "${LIBSSH2_VERSION_MAJOR}.${LIBSSH2_VERSION_MINOR}.${LIBSSH2_VERSION_PATCH}")
+ file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION[\t ]+\"(.*)\"")
+ string(REGEX REPLACE "^.*\"([^\"]+)\"" "\\1" LIBSSH2_VERSION "${libssh2_version_str}")
endif()
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(LibSSH2 DEFAULT_MSG LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY )
+find_package_handle_standard_args(LibSSH2
+ REQUIRED_VARS LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR
+ VERSION_VAR LIBSSH2_VERSION)
-mark_as_advanced(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY LIBSSH2_VERSION_MAJOR LIBSSH2_VERSION_MINOR LIBSSH2_VERSION_PATCH LIBSSH2_VERSION)
+mark_as_advanced(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY)
diff --git a/CMake/FindNGHTTP2.cmake b/CMake/FindNGHTTP2.cmake
index 348b9612d..5138e9999 100644
--- a/CMake/FindNGHTTP2.cmake
+++ b/CMake/FindNGHTTP2.cmake
@@ -10,9 +10,9 @@ find_package_handle_standard_args(NGHTTP2
REQUIRED_VARS
NGHTTP2_LIBRARY
NGHTTP2_INCLUDE_DIR
- FAIL_MESSAGE
- "Could NOT find NGHTTP2"
)
set(NGHTTP2_INCLUDE_DIRS ${NGHTTP2_INCLUDE_DIR})
set(NGHTTP2_LIBRARIES ${NGHTTP2_LIBRARY})
+
+mark_as_advanced(NGHTTP2_INCLUDE_DIRS NGHTTP2_LIBRARIES)
diff --git a/CMake/FindNSS.cmake b/CMake/FindNSS.cmake
index 277c7dfb2..0043ce853 100644
--- a/CMake/FindNSS.cmake
+++ b/CMake/FindNSS.cmake
@@ -10,6 +10,8 @@ set(NSS_LIBRARIES ${PC_NSS_LINK_LIBRARIES})
set(NSS_INCLUDE_DIRS ${PC_NSS_INCLUDE_DIRS})
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(NSS DEFAULT_MSG NSS_INCLUDE_DIRS NSS_LIBRARIES)
+find_package_handle_standard_args(NSS
+ REQUIRED_VARS NSS_LIBRARIES NSS_INCLUDE_DIRS
+ VERSION_VAR PC_NSS_VERSION)
mark_as_advanced(NSS_INCLUDE_DIRS NSS_LIBRARIES)
diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake
index c1c9aa32a..8b150290c 100644
--- a/CMake/OtherTests.cmake
+++ b/CMake/OtherTests.cmake
@@ -32,7 +32,7 @@ int main(void) {
return 0;
}" curl_cv_recv)
if(curl_cv_recv)
- if(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
+ if(NOT DEFINED curl_cv_func_recv_args OR curl_cv_func_recv_args STREQUAL "unknown")
foreach(recv_retv "int" "ssize_t" )
foreach(recv_arg1 "SOCKET" "int" )
foreach(recv_arg2 "char *" "void *" )
@@ -81,7 +81,7 @@ if(curl_cv_recv)
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}")
endif()
- if("${curl_cv_func_recv_args}" STREQUAL "unknown")
+ if(curl_cv_func_recv_args STREQUAL "unknown")
message(FATAL_ERROR "Cannot find proper types to use for recv args")
endif()
else()
diff --git a/CMake/Utilities.cmake b/CMake/Utilities.cmake
index 5cb1d4497..ffc411ae9 100644
--- a/CMake/Utilities.cmake
+++ b/CMake/Utilities.cmake
@@ -2,12 +2,11 @@
# Returns a list of arguments that evaluate to true
function(count_true output_count_var)
- set(lst)
+ set(lst_len 0)
foreach(option_var IN LISTS ARGN)
if(${option_var})
- list(APPEND lst ${option_var})
+ math(EXPR lst_len "${lst_len} + 1")
endif()
endforeach()
- list(LENGTH lst lst_len)
set(${output_count_var} ${lst_len} PARENT_SCOPE)
endfunction()