]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: tidy up string append and list prepend syntax
authorViktor Szakats <commit@vsz.me>
Sat, 1 Feb 2025 11:31:13 +0000 (12:31 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 6 Feb 2025 22:25:40 +0000 (23:25 +0100)
- `set(VAR "${VAR}<value>")` ->
  `string(APPEND VAR "<value>")`
  Available since CMake 3.4:
  https://cmake.org/cmake/help/latest/command/string.html#append

- `set(VAR "${VAR2}-or-<value>;${VAR}")` ->
  `set(VAR "${VAR2}-or-<value>" ${VAR})`

Closes #16144

CMake/PickyWarnings.cmake
CMakeLists.txt
tests/CMakeLists.txt
tests/runtests.pl

index 23341c49b8b51568f1edae75a277528b49d19a78..15f771b3e34419512763b5c885917cf5ebc47c58 100644 (file)
@@ -274,6 +274,6 @@ endif()
 
 if(_picky)
   string(REPLACE ";" " " _picky "${_picky}")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_picky}")
+  string(APPEND CMAKE_C_FLAGS " ${_picky}")
   message(STATUS "Picky compiler options: ${_picky}")
 endif()
index afd2ff7d9088dc991fe8fe528d7d5bc56846f45c..1e09bf0c7d16bc55a89f594f35031665cf46b753 100644 (file)
@@ -61,12 +61,12 @@ if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "")
       else()
         set(_cache_var_type ":${_cache_var_type}")
       endif()
-      set(_cmake_args "${_cmake_args} -D${_cache_var}${_cache_var_type}=\"${_cache_var_value}\"")
+      string(APPEND _cmake_args " -D${_cache_var}${_cache_var_type}=\"${_cache_var_value}\"")
     endif()
   endforeach()
 endif()
 
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
 include(Utilities)
 include(Macros)
 include(CMakeDependentOption)
@@ -105,49 +105,49 @@ endif()
 
 set(_target_flags "")
 if(APPLE)
-  set(_target_flags "${_target_flags} APPLE")
+  string(APPEND _target_flags " APPLE")
 endif()
 if(UNIX)
-  set(_target_flags "${_target_flags} UNIX")
+  string(APPEND _target_flags " UNIX")
 endif()
 if(BSD)
-  set(_target_flags "${_target_flags} BSD")
+  string(APPEND _target_flags " BSD")
 endif()
 if(ANDROID)
-  set(_target_flags "${_target_flags} ANDROID-${ANDROID_PLATFORM_LEVEL}")
+  string(APPEND _target_flags " ANDROID-${ANDROID_PLATFORM_LEVEL}")
 endif()
 if(WIN32)
-  set(_target_flags "${_target_flags} WIN32")
+  string(APPEND _target_flags " WIN32")
 endif()
 if(WINDOWS_STORE)
-  set(_target_flags "${_target_flags} UWP")
+  string(APPEND _target_flags " UWP")
 endif()
 if(CYGWIN)
-  set(_target_flags "${_target_flags} CYGWIN")
+  string(APPEND _target_flags " CYGWIN")
 endif()
 if(MSYS)
-  set(_target_flags "${_target_flags} MSYS")
+  string(APPEND _target_flags " MSYS")
 endif()
 if(DOS)
-  set(_target_flags "${_target_flags} DOS")
+  string(APPEND _target_flags " DOS")
 endif()
 if(AMIGA)
-  set(_target_flags "${_target_flags} AMIGA")
+  string(APPEND _target_flags " AMIGA")
 endif()
 if(CMAKE_COMPILER_IS_GNUCC)
-  set(_target_flags "${_target_flags} GCC")
+  string(APPEND _target_flags " GCC")
 endif()
 if(MINGW)
-  set(_target_flags "${_target_flags} MINGW")
+  string(APPEND _target_flags " MINGW")
 endif()
 if(MSVC)
-  set(_target_flags "${_target_flags} MSVC-${MSVC_VERSION}")
+  string(APPEND _target_flags " MSVC-${MSVC_VERSION}")
 endif()
 if(VCPKG_TOOLCHAIN)
-  set(_target_flags "${_target_flags} VCPKG")
+  string(APPEND _target_flags " VCPKG")
 endif()
 if(CMAKE_CROSSCOMPILING)
-  set(_target_flags "${_target_flags} CROSS")
+  string(APPEND _target_flags " CROSS")
 endif()
 message(STATUS "CMake platform flags:${_target_flags}")
 
@@ -193,8 +193,8 @@ if(WIN32)
   option(CURL_STATIC_CRT "Build libcurl with static CRT with MSVC (/MT)" OFF)
   if(CURL_STATIC_CRT AND MSVC)
     set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
-    set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -MT")
-    set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -MTd")
+    string(APPEND CMAKE_C_FLAGS_RELEASE " -MT")
+    string(APPEND CMAKE_C_FLAGS_DEBUG " -MTd")
   endif()
 
   option(ENABLE_UNICODE "Use the Unicode version of the Windows API functions" OFF)
@@ -256,7 +256,7 @@ endif()
 include(PickyWarnings)
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")  # Required for sendmmsg()
+  string(APPEND CMAKE_C_FLAGS " -D_GNU_SOURCE")  # Required for sendmmsg()
 endif()
 
 option(ENABLE_DEBUG "Enable curl debug features (for developing curl itself)" OFF)
@@ -350,7 +350,7 @@ if(ENABLE_ARES)
   list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${CARES_PC_REQUIRES})
   link_directories(${CARES_LIBRARY_DIRS})
   if(CARES_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CARES_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${CARES_CFLAGS}")
   endif()
 endif()
 
@@ -542,7 +542,7 @@ endif()
 
 # Disable warnings on Borland to avoid changing 3rd party code.
 if(BORLAND)
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
+  string(APPEND CMAKE_C_FLAGS " -w-")
 endif()
 
 # If we are on AIX, do the _ALL_SOURCE magic
@@ -619,7 +619,7 @@ elseif(AMIGA)
 elseif(NOT WIN32 AND NOT APPLE)
   check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
   if(HAVE_LIBSOCKET)
-    set(CURL_LIBS "socket;${CURL_LIBS}")
+    set(CURL_LIBS "socket" ${CURL_LIBS})
   endif()
 endif()
 
@@ -793,7 +793,7 @@ if(CURL_USE_MBEDTLS)
   include_directories(SYSTEM ${MBEDTLS_INCLUDE_DIRS})
   link_directories(${MBEDTLS_LIBRARY_DIRS})
   if(MBEDTLS_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MBEDTLS_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${MBEDTLS_CFLAGS}")
   endif()
 
   if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "mbedtls")
@@ -827,7 +827,7 @@ if(CURL_USE_WOLFSSL)
   include_directories(SYSTEM ${WOLFSSL_INCLUDE_DIRS})
   link_directories(${WOLFSSL_LIBRARY_DIRS})
   if(WOLFSSL_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WOLFSSL_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${WOLFSSL_CFLAGS}")
   endif()
 
   if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "wolfssl")
@@ -856,7 +856,7 @@ if(CURL_USE_GNUTLS)
   include_directories(SYSTEM ${GNUTLS_INCLUDE_DIRS} ${NETTLE_INCLUDE_DIRS})
   link_directories(${NETTLE_LIBRARY_DIRS})
   if(NETTLE_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NETTLE_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${NETTLE_CFLAGS}")
   endif()
 
   if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "gnutls")
@@ -883,7 +883,7 @@ if(CURL_USE_RUSTLS)
   include_directories(SYSTEM ${RUSTLS_INCLUDE_DIRS})
   link_directories(${RUSTLS_LIBRARY_DIRS})
   if(RUSTLS_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${RUSTLS_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${RUSTLS_CFLAGS}")
   endif()
 
   if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "rustls")
@@ -919,7 +919,7 @@ if(BROTLI_FOUND)
   include_directories(SYSTEM ${BROTLI_INCLUDE_DIRS})
   link_directories(${BROTLI_LIBRARY_DIRS})
   if(BROTLI_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${BROTLI_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${BROTLI_CFLAGS}")
   endif()
 endif()
 
@@ -934,7 +934,7 @@ if(ZSTD_FOUND)
     include_directories(SYSTEM ${ZSTD_INCLUDE_DIRS})
     link_directories(${ZSTD_LIBRARY_DIRS})
     if(ZSTD_CFLAGS)
-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZSTD_CFLAGS}")
+      string(APPEND CMAKE_C_FLAGS " ${ZSTD_CFLAGS}")
     endif()
   else()
     message(WARNING "zstd v1.0.0 or newer is required, disabling zstd support.")
@@ -1053,7 +1053,7 @@ if(USE_NGHTTP2)
     include_directories(SYSTEM ${NGHTTP2_INCLUDE_DIRS})
     link_directories(${NGHTTP2_LIBRARY_DIRS})
     if(NGHTTP2_CFLAGS)
-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NGHTTP2_CFLAGS}")
+      string(APPEND CMAKE_C_FLAGS " ${NGHTTP2_CFLAGS}")
     endif()
   else()
     set(USE_NGHTTP2 OFF)
@@ -1085,7 +1085,7 @@ if(USE_NGTCP2)
   include_directories(SYSTEM ${NGTCP2_INCLUDE_DIRS})
   link_directories(${NGTCP2_LIBRARY_DIRS})
   if(NGTCP2_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NGTCP2_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${NGTCP2_CFLAGS}")
   endif()
 
   find_package(NGHTTP3 REQUIRED)
@@ -1096,7 +1096,7 @@ if(USE_NGTCP2)
   include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS})
   link_directories(${NGHTTP3_LIBRARY_DIRS})
   if(NGHTTP3_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NGHTTP3_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${NGHTTP3_CFLAGS}")
   endif()
 endif()
 
@@ -1116,7 +1116,7 @@ if(USE_QUICHE)
   include_directories(SYSTEM ${QUICHE_INCLUDE_DIRS})
   link_directories(${QUICHE_LIBRARY_DIRS})
   if(QUICHE_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${QUICHE_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${QUICHE_CFLAGS}")
   endif()
   if(NOT DEFINED HAVE_QUICHE_CONN_SET_QLOG_FD)
     cmake_push_check_state()
@@ -1145,7 +1145,7 @@ if(USE_MSH3)
   include_directories(SYSTEM ${MSH3_INCLUDE_DIRS})
   link_directories(${MSH3_LIBRARY_DIRS})
   if(MSH3_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MSH3_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${MSH3_CFLAGS}")
   endif()
 endif()
 
@@ -1191,15 +1191,15 @@ if(NOT CURL_DISABLE_LDAP)
     find_package(LDAP)
     if(LDAP_FOUND)
       set(HAVE_LBER_H 1)
-      set(CURL_LIBS "${LDAP_LIBRARIES};${CURL_LIBS}")
+      set(CURL_LIBS ${LDAP_LIBRARIES} ${CURL_LIBS})
       list(APPEND CURL_LIBDIRS ${LDAP_LIBRARY_DIRS})
       if(LDAP_PC_REQUIRES)
-        set(LIBCURL_PC_REQUIRES_PRIVATE "${LDAP_PC_REQUIRES};${LIBCURL_PC_REQUIRES_PRIVATE}")
+        set(LIBCURL_PC_REQUIRES_PRIVATE ${LDAP_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
       endif()
       include_directories(SYSTEM ${LDAP_INCLUDE_DIRS})
       link_directories(${LDAP_LIBRARY_DIRS})
       if(LDAP_CFLAGS)
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LDAP_CFLAGS}")
+        string(APPEND CMAKE_C_FLAGS " ${LDAP_CFLAGS}")
       endif()
 
       # LDAP feature checks
@@ -1269,13 +1269,13 @@ set(HAVE_LIBIDN2 OFF)
 if(USE_LIBIDN2 AND NOT USE_APPLE_IDN AND NOT USE_WIN32_IDN)
   find_package(Libidn2)
   if(LIBIDN2_FOUND)
-    set(CURL_LIBS "${LIBIDN2_LIBRARIES};${CURL_LIBS}")
+    set(CURL_LIBS ${LIBIDN2_LIBRARIES} ${CURL_LIBS})
     list(APPEND CURL_LIBDIRS ${LIBIDN2_LIBRARY_DIRS})
-    set(LIBCURL_PC_REQUIRES_PRIVATE "${LIBIDN2_PC_REQUIRES};${LIBCURL_PC_REQUIRES_PRIVATE}")
+    set(LIBCURL_PC_REQUIRES_PRIVATE ${LIBIDN2_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
     include_directories(SYSTEM ${LIBIDN2_INCLUDE_DIRS})
     link_directories(${LIBIDN2_LIBRARY_DIRS})
     if(LIBIDN2_CFLAGS)
-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBIDN2_CFLAGS}")
+      string(APPEND CMAKE_C_FLAGS " ${LIBIDN2_CFLAGS}")
     endif()
     set(HAVE_IDN2_H 1)
     set(HAVE_LIBIDN2 1)
@@ -1295,7 +1295,7 @@ if(CURL_USE_LIBPSL)
   include_directories(SYSTEM ${LIBPSL_INCLUDE_DIRS})
   link_directories(${LIBPSL_LIBRARY_DIRS})
   if(LIBPSL_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBPSL_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${LIBPSL_CFLAGS}")
   endif()
   set(USE_LIBPSL ON)
 endif()
@@ -1314,7 +1314,7 @@ if(CURL_USE_LIBSSH2)
     include_directories(SYSTEM ${LIBSSH2_INCLUDE_DIRS})
     link_directories(${LIBSSH2_LIBRARY_DIRS})
     if(LIBSSH2_CFLAGS)
-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSSH2_CFLAGS}")
+      string(APPEND CMAKE_C_FLAGS " ${LIBSSH2_CFLAGS}")
     endif()
     set(USE_LIBSSH2 ON)
   endif()
@@ -1331,7 +1331,7 @@ if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
   include_directories(SYSTEM ${LIBSSH_INCLUDE_DIRS})
   link_directories(${LIBSSH_LIBRARY_DIRS})
   if(LIBSSH_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSSH_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${LIBSSH_CFLAGS}")
   endif()
   set(USE_LIBSSH ON)
 endif()
@@ -1363,7 +1363,7 @@ if(CURL_USE_GSASL)
   include_directories(SYSTEM ${LIBGSASL_INCLUDE_DIRS})
   link_directories(${LIBGSASL_LIBRARY_DIRS})
   if(LIBGSASL_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBGSASL_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${LIBGSASL_CFLAGS}")
   endif()
   set(USE_GSASL ON)
 endif()
@@ -1382,7 +1382,7 @@ if(CURL_USE_GSSAPI)
     include_directories(SYSTEM ${GSS_INCLUDE_DIRS})
     link_directories(${GSS_LIBRARY_DIRS})
     if(GSS_CFLAGS)
-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GSS_CFLAGS}")
+      string(APPEND CMAKE_C_FLAGS " ${GSS_CFLAGS}")
     endif()
 
     if(GSS_FLAVOUR STREQUAL "GNU")
@@ -1408,7 +1408,7 @@ if(CURL_USE_GSSAPI)
         endif()
 
         if(NOT DEFINED HAVE_GSS_C_NT_HOSTBASED_SERVICE)
-          set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${GSS_CFLAGS}")
+          string(APPEND CMAKE_REQUIRED_FLAGS " ${GSS_CFLAGS}")
           list(APPEND CMAKE_REQUIRED_LIBRARIES ${GSS_LIBRARIES})
           curl_required_libpaths("${GSS_LIBRARY_DIRS}")
           check_symbol_exists("GSS_C_NT_HOSTBASED_SERVICE" "${_include_list}" HAVE_GSS_C_NT_HOSTBASED_SERVICE)
@@ -1438,7 +1438,7 @@ if(CURL_USE_LIBUV)
   include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
   link_directories(${LIBUV_LIBRARY_DIRS})
   if(LIBUV_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUV_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${LIBUV_CFLAGS}")
   endif()
   set(USE_LIBUV ON)
   set(HAVE_UV_H ON)
@@ -1453,7 +1453,7 @@ if(USE_LIBRTMP)
   include_directories(SYSTEM ${LIBRTMP_INCLUDE_DIRS})
   link_directories(${LIBRTMP_LIBRARY_DIRS})
   if(LIBRTMP_CFLAGS)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBRTMP_CFLAGS}")
+    string(APPEND CMAKE_C_FLAGS " ${LIBRTMP_CFLAGS}")
   endif()
 endif()
 
@@ -1650,7 +1650,7 @@ foreach(_variable IN ITEMS
     HAVE_UNISTD_H
     )
   if(${_variable})
-    set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${_variable}")
+    string(APPEND CURL_TEST_DEFINES " -D${_variable}")
   endif()
 endforeach()
 
@@ -1911,7 +1911,7 @@ if(CMAKE_COMPILER_IS_GNUCC AND APPLE)
     # The Mac version of GCC warns about use of long double. Disable it.
     get_source_file_property(_mprintf_compile_flags "mprintf.c" COMPILE_FLAGS)
     if(_mprintf_compile_flags)
-      set(_mprintf_compile_flags "${_mprintf_compile_flags} -Wno-long-double")
+      string(APPEND _mprintf_compile_flags " -Wno-long-double")
     else()
       set(_mprintf_compile_flags "-Wno-long-double")
     endif()
@@ -1936,7 +1936,7 @@ if(WIN32)
   endif()
 
   # Use the manifest embedded in the Windows Resource
-  set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DCURL_EMBED_MANIFEST")
+  string(APPEND CMAKE_RC_FLAGS " -DCURL_EMBED_MANIFEST")
 
   # We use crypto functions that are not available for UWP apps
   if(NOT WINDOWS_STORE)
@@ -1951,26 +1951,25 @@ endif()
 
 if(MSVC)
   # Disable default manifest added by CMake
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -MANIFEST:NO")
+  string(APPEND CMAKE_EXE_LINKER_FLAGS " -MANIFEST:NO")
 
   if(CMAKE_C_FLAGS MATCHES "[/-]W[0-4]")
     string(REGEX REPLACE "[/-]W[0-4]" "-W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
   else()
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W4")
+    string(APPEND CMAKE_C_FLAGS " -W4")
   endif()
 
   # Use multithreaded compilation on VS2008+
   if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1500)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MP")
+    string(APPEND CMAKE_C_FLAGS " -MP")
   endif()
 endif()
 
 if(CURL_WERROR)
   if(MSVC)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -WX")
+    string(APPEND CMAKE_C_FLAGS " -WX")
   else()
-    # This assumes clang or gcc style options
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+    string(APPEND CMAKE_C_FLAGS " -Werror")  # This assumes clang or gcc style options
   endif()
 endif()
 
@@ -2244,15 +2243,15 @@ if(NOT CURL_DISABLE_INSTALL)
   set(_sys_libdirs "")
   foreach(_libdir IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
     if(_libdir MATCHES "/$")
-      set(_libdir "${_libdir}lib")
+      string(APPEND _libdir "lib")
     else()
-      set(_libdir "${_libdir}/lib")
+      string(APPEND _libdir "/lib")
     endif()
     if(IS_DIRECTORY "${_libdir}")
       list(APPEND _sys_libdirs "${_libdir}")
     endif()
     if(DEFINED CMAKE_LIBRARY_ARCHITECTURE)
-      set(_libdir "${_libdir}/${CMAKE_LIBRARY_ARCHITECTURE}")
+      string(APPEND _libdir "/${CMAKE_LIBRARY_ARCHITECTURE}")
       if(IS_DIRECTORY "${_libdir}")
         list(APPEND _sys_libdirs "${_libdir}")
       endif()
index 795dc51c4b17b1d75d40646e0eb6092de9ac34bf..47b01a3faccf4ae739d555cfd002ff8106b93282 100644 (file)
@@ -41,10 +41,10 @@ add_subdirectory(certs EXCLUDE_FROM_ALL)
 
 function(curl_add_runtests _targetname _test_flags)
   if(CURL_TEST_BUNDLES)
-    set(_test_flags "${_test_flags} -bundle")
+    string(APPEND _test_flags " -bundle")
   endif()
   if(NOT BUILD_LIBCURL_DOCS)
-    set(_test_flags "${_test_flags} !documentation")
+    string(APPEND _test_flags " !documentation")
   endif()
   # Skip walking through dependent targets before running tests in CI.
   # This avoids: GNU Make doing a slow re-evaluation of all targets and
@@ -85,12 +85,12 @@ endfunction()
 if(MSVC OR CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
   set(CURL_CPP "\"${CMAKE_C_COMPILER}\" -E")
   if(APPLE AND CMAKE_OSX_SYSROOT)
-    set(CURL_CPP "${CURL_CPP} -isysroot ${CMAKE_OSX_SYSROOT}")
+    string(APPEND CURL_CPP " -isysroot ${CMAKE_OSX_SYSROOT}")
   endif()
   # Add header directories, like autotools builds do.
   get_property(_include_dirs TARGET ${LIB_SELECTED} PROPERTY INCLUDE_DIRECTORIES)
   foreach(_include_dir IN LISTS _include_dirs)
-    set(CURL_CPP "${CURL_CPP} -I${_include_dir}")
+    string(APPEND CURL_CPP " -I${_include_dir}")
   endforeach()
 else()
   set(CURL_CPP "cpp")
index 2d8945583e66387c77b974547183aa32fc293cd4..0ca69fec4c8acb5f56f9940d729b0bc050f8fd19 100755 (executable)
@@ -670,15 +670,11 @@ sub checksystemfeatures {
             $feature{"alt-svc"} = $feat =~ /alt-svc/i;
             # HSTS support
             $feature{"HSTS"} = $feat =~ /HSTS/i;
-            $feature{"asyn-rr"} = $feat =~ /asyn-rr/;
             if($feat =~ /AsynchDNS/i) {
-                if(!$feature{"c-ares"} || $feature{"asyn-rr"}) {
+                if(!$feature{"c-ares"}) {
                     # this means threaded resolver
                     $feature{"threaded-resolver"} = 1;
                     $resolver="threaded";
-
-                    # does not count as "real" c-ares
-                    $feature{"c-ares"} = 0;
                 }
             }
             # http2 enabled
@@ -702,6 +698,7 @@ sub checksystemfeatures {
             # Thread-safe init
             $feature{"threadsafe"} = $feat =~ /threadsafe/i;
             $feature{"HTTPSRR"} = $feat =~ /HTTPSRR/;
+            $feature{"asyn-rr"} = $feat =~ /asyn-rr/;
         }
         #
         # Test harness currently uses a non-stunnel server in order to