diff --git a/.github/workflows/linux-old.yml b/.github/workflows/linux-old.yml index af51acb73c..0d45f5b1d9 100644 --- a/.github/workflows/linux-old.yml +++ b/.github/workflows/linux-old.yml @@ -69,7 +69,7 @@ jobs: sha256sum freexian-archive-keyring_2022.06.08_all.deb && dpkg -i freexian-archive-keyring_2022.06.08_all.deb echo 'deb http://deb.freexian.com/extended-lts stretch-lts main contrib non-free' | tee /etc/apt/sources.list.d/extended-lts.list apt-get -o Dpkg::Use-Pty=0 update - apt-get -o Dpkg::Use-Pty=0 install -y --no-install-suggests --no-install-recommends make automake autoconf libtool gcc pkg-config libpsl-dev libzstd-dev zlib1g-dev libc-ares-dev libkrb5-dev libldap2-dev librtmp-dev stunnel4 + apt-get -o Dpkg::Use-Pty=0 install -y --no-install-suggests --no-install-recommends make automake autoconf libtool ninja-build gcc pkg-config libpsl-dev libzstd-dev zlib1g-dev libc-ares-dev libkrb5-dev libldap2-dev librtmp-dev stunnel4 # GitHub's actions/checkout needs newer glibc and libstdc++. The latter also depends on # gcc-8-base, but it does not actually seem used in our situation and is not available in # the main repo, so force the install. @@ -79,8 +79,8 @@ jobs: - name: 'install prereqs (cmake)' env: - CMAKE_VERSION: 3.7.0 # Earliest version supported by curl - CMAKE_SHA256: e075f63e6a9104b1c3d11666ae9546bc8812f7e791a49c4ce11effc063141b2a + CMAKE_VERSION: 3.18.0 # Earliest version supported by curl + CMAKE_SHA256: 4d9a9d3351161073a67e49366d701b6fa4b0343781982dc5eef08a02a750d403 run: | cd ~ fn="cmake-${CMAKE_VERSION}-linux-x86_64" @@ -94,13 +94,13 @@ jobs: - name: 'CM build-only configure (out-of-tree)' run: | - mkdir bld-1 - cd bld-1 - ~/cmake/bin/cmake .. -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON \ + ~/cmake/bin/cmake -B bld-1 -G Ninja -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON \ -DCURL_ENABLE_SSL=OFF -DENABLE_ARES=OFF -DCURL_ZSTD=OFF -DCURL_USE_GSSAPI=OFF -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=OFF -DUSE_LIBRTMP=ON - name: 'CM build-only build' - run: VERBOSE=1 make -C bld-1 install + run: | + ~/cmake/bin/cmake --build bld-1 --verbose + ~/cmake/bin/cmake --install bld-1 --verbose - name: 'CM build-only curl -V' run: bld-1/src/curl --disable --version @@ -118,9 +118,7 @@ jobs: # that enabled again - name: 'CM configure (out-of-tree, c-ares, zstd, gssapi)' run: | - mkdir bld-cares - cd bld-cares - ~/cmake/bin/cmake .. -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON \ + ~/cmake/bin/cmake -B bld-cares -G Ninja -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON \ -DCURL_ENABLE_SSL=OFF -DENABLE_ARES=ON -DCURL_USE_GSSAPI=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=OFF -DUSE_LIBRTMP=ON \ -DCURL_LIBCURL_VERSIONED_SYMBOLS=ON @@ -134,22 +132,22 @@ jobs: grep -F '#define' bld-cares/lib/curl_config.h | sort || true - name: 'CM build' - run: make -C bld-cares + run: ~/cmake/bin/cmake --build bld-cares - name: 'CM curl -V' run: bld-cares/src/curl --disable --version - name: 'CM install' - run: make -C bld-cares install + run: ~/cmake/bin/cmake --install bld-cares - name: 'CM build tests' - run: make -C bld-cares testdeps + run: ~/cmake/bin/cmake --build bld-cares --target testdeps - name: 'CM run tests' - run: make -C bld-cares test-ci + run: ~/cmake/bin/cmake --build bld-cares --target test-ci - name: 'CM build examples' - run: make -C bld-cares curl-examples-build + run: ~/cmake/bin/cmake --build bld-cares --target curl-examples-build - name: 'AM autoreconf' run: autoreconf -fi diff --git a/CMake/FindBrotli.cmake b/CMake/FindBrotli.cmake index b5437e7525..bd3363cce0 100644 --- a/CMake/FindBrotli.cmake +++ b/CMake/FindBrotli.cmake @@ -84,10 +84,6 @@ else() endif() if(BROTLI_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_brotli_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::brotli) add_library(CURL::brotli INTERFACE IMPORTED) set_target_properties(CURL::brotli PROPERTIES diff --git a/CMake/FindCares.cmake b/CMake/FindCares.cmake index 3c05c3b2eb..19b6a03103 100644 --- a/CMake/FindCares.cmake +++ b/CMake/FindCares.cmake @@ -106,10 +106,6 @@ if(CARES_FOUND) list(APPEND _cares_LIBRARIES "iphlpapi") # for if_indextoname and others endif() - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_cares_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::cares) add_library(CURL::cares INTERFACE IMPORTED) set_target_properties(CURL::cares PROPERTIES diff --git a/CMake/FindGSS.cmake b/CMake/FindGSS.cmake index e36f75bf9c..9237fb30b1 100644 --- a/CMake/FindGSS.cmake +++ b/CMake/FindGSS.cmake @@ -258,10 +258,6 @@ mark_as_advanced( ) if(GSS_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_gss_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::gss) add_library(CURL::gss INTERFACE IMPORTED) set_target_properties(CURL::gss PROPERTIES diff --git a/CMake/FindGnuTLS.cmake b/CMake/FindGnuTLS.cmake index fff57b2c29..7f5b227dc2 100644 --- a/CMake/FindGnuTLS.cmake +++ b/CMake/FindGnuTLS.cmake @@ -80,10 +80,6 @@ else() endif() if(GNUTLS_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_gnutls_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::gnutls) add_library(CURL::gnutls INTERFACE IMPORTED) set_target_properties(CURL::gnutls PROPERTIES diff --git a/CMake/FindLDAP.cmake b/CMake/FindLDAP.cmake index 2f5cc713c7..8902b23f8d 100644 --- a/CMake/FindLDAP.cmake +++ b/CMake/FindLDAP.cmake @@ -103,10 +103,6 @@ else() endif() if(LDAP_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_ldap_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::ldap) add_library(CURL::ldap INTERFACE IMPORTED) set_target_properties(CURL::ldap PROPERTIES diff --git a/CMake/FindLibbacktrace.cmake b/CMake/FindLibbacktrace.cmake index c6f7b700c4..59da7fdf19 100644 --- a/CMake/FindLibbacktrace.cmake +++ b/CMake/FindLibbacktrace.cmake @@ -47,10 +47,6 @@ if(LIBBACKTRACE_FOUND) set(_libbacktrace_INCLUDE_DIRS ${LIBBACKTRACE_INCLUDE_DIR}) set(_libbacktrace_LIBRARIES ${LIBBACKTRACE_LIBRARY}) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_libbacktrace_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::libbacktrace) add_library(CURL::libbacktrace INTERFACE IMPORTED) set_target_properties(CURL::libbacktrace PROPERTIES diff --git a/CMake/FindLibgsasl.cmake b/CMake/FindLibgsasl.cmake index 5ddf957d72..7fbaa7128f 100644 --- a/CMake/FindLibgsasl.cmake +++ b/CMake/FindLibgsasl.cmake @@ -79,10 +79,6 @@ else() endif() if(LIBGSASL_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_libgsasl_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::libgsasl) add_library(CURL::libgsasl INTERFACE IMPORTED) set_target_properties(CURL::libgsasl PROPERTIES diff --git a/CMake/FindLibidn2.cmake b/CMake/FindLibidn2.cmake index 336a7f7b40..dc7873489a 100644 --- a/CMake/FindLibidn2.cmake +++ b/CMake/FindLibidn2.cmake @@ -80,10 +80,6 @@ else() endif() if(LIBIDN2_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_libidn2_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::libidn2) add_library(CURL::libidn2 INTERFACE IMPORTED) set_target_properties(CURL::libidn2 PROPERTIES diff --git a/CMake/FindLibpsl.cmake b/CMake/FindLibpsl.cmake index 9b1a0cdd97..2287e676d3 100644 --- a/CMake/FindLibpsl.cmake +++ b/CMake/FindLibpsl.cmake @@ -80,10 +80,6 @@ else() endif() if(LIBPSL_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_libpsl_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::libpsl) add_library(CURL::libpsl INTERFACE IMPORTED) set_target_properties(CURL::libpsl PROPERTIES diff --git a/CMake/FindLibrtmp.cmake b/CMake/FindLibrtmp.cmake index 853ba63ad0..c906cb77e7 100644 --- a/CMake/FindLibrtmp.cmake +++ b/CMake/FindLibrtmp.cmake @@ -58,14 +58,8 @@ else() file(STRINGS "${LIBRTMP_INCLUDE_DIR}/librtmp/rtmp.h" _version_str REGEX "${_version_regex}") string(REGEX REPLACE "${_version_regex}" "\\1" _version_str1 "${_version_str}") string(REGEX REPLACE "${_version_regex}" "\\2" _version_str2 "${_version_str}") - if(CMAKE_VERSION VERSION_LESS 3.13) - # No support for hex version numbers, just strip leading zeroes - string(REGEX REPLACE "^0" "" _version_str1 "${_version_str1}") - string(REGEX REPLACE "^0" "" _version_str2 "${_version_str2}") - else() - math(EXPR _version_str1 "0x${_version_str1}" OUTPUT_FORMAT DECIMAL) - math(EXPR _version_str2 "0x${_version_str2}" OUTPUT_FORMAT DECIMAL) - endif() + math(EXPR _version_str1 "0x${_version_str1}" OUTPUT_FORMAT DECIMAL) + math(EXPR _version_str2 "0x${_version_str2}" OUTPUT_FORMAT DECIMAL) set(LIBRTMP_VERSION "${_version_str1}.${_version_str2}") unset(_version_regex) unset(_version_str1) @@ -100,10 +94,6 @@ if(LIBRTMP_FOUND) list(APPEND _librtmp_LIBRARIES "winmm") endif() - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_librtmp_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::librtmp) add_library(CURL::librtmp INTERFACE IMPORTED) set_target_properties(CURL::librtmp PROPERTIES diff --git a/CMake/FindLibssh.cmake b/CMake/FindLibssh.cmake index 732ab8ee27..3837d4de62 100644 --- a/CMake/FindLibssh.cmake +++ b/CMake/FindLibssh.cmake @@ -106,10 +106,6 @@ if(LIBSSH_FOUND) list(APPEND _libssh_LIBRARIES "iphlpapi") # for if_nametoindex endif() - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_libssh_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::libssh) add_library(CURL::libssh INTERFACE IMPORTED) set_target_properties(CURL::libssh PROPERTIES diff --git a/CMake/FindLibssh2.cmake b/CMake/FindLibssh2.cmake index abed471eb2..33463983dc 100644 --- a/CMake/FindLibssh2.cmake +++ b/CMake/FindLibssh2.cmake @@ -91,10 +91,6 @@ else() endif() if(LIBSSH2_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_libssh2_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::libssh2) add_library(CURL::libssh2 INTERFACE IMPORTED) set_target_properties(CURL::libssh2 PROPERTIES diff --git a/CMake/FindLibuv.cmake b/CMake/FindLibuv.cmake index f9d614bc06..47d043cff6 100644 --- a/CMake/FindLibuv.cmake +++ b/CMake/FindLibuv.cmake @@ -90,10 +90,6 @@ else() endif() if(LIBUV_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_libuv_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::libuv) add_library(CURL::libuv INTERFACE IMPORTED) set_target_properties(CURL::libuv PROPERTIES diff --git a/CMake/FindMbedTLS.cmake b/CMake/FindMbedTLS.cmake index 8b67ce9acf..0ebe90a3f0 100644 --- a/CMake/FindMbedTLS.cmake +++ b/CMake/FindMbedTLS.cmake @@ -110,10 +110,6 @@ else() endif() if(MBEDTLS_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_mbedtls_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::mbedtls) add_library(CURL::mbedtls INTERFACE IMPORTED) set_target_properties(CURL::mbedtls PROPERTIES diff --git a/CMake/FindNGHTTP2.cmake b/CMake/FindNGHTTP2.cmake index b2a8c97ccd..2d2d874caf 100644 --- a/CMake/FindNGHTTP2.cmake +++ b/CMake/FindNGHTTP2.cmake @@ -91,10 +91,6 @@ else() endif() if(NGHTTP2_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_nghttp2_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::nghttp2) add_library(CURL::nghttp2 INTERFACE IMPORTED) set_target_properties(CURL::nghttp2 PROPERTIES diff --git a/CMake/FindNGHTTP3.cmake b/CMake/FindNGHTTP3.cmake index 57550bffaf..32750b4d66 100644 --- a/CMake/FindNGHTTP3.cmake +++ b/CMake/FindNGHTTP3.cmake @@ -91,10 +91,6 @@ else() endif() if(NGHTTP3_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_nghttp3_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::nghttp3) add_library(CURL::nghttp3 INTERFACE IMPORTED) set_target_properties(CURL::nghttp3 PROPERTIES diff --git a/CMake/FindNGTCP2.cmake b/CMake/FindNGTCP2.cmake index 615ee4a3c2..ae21a843cf 100644 --- a/CMake/FindNGTCP2.cmake +++ b/CMake/FindNGTCP2.cmake @@ -155,10 +155,6 @@ else() endif() if(NGTCP2_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_ngtcp2_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::ngtcp2) add_library(CURL::ngtcp2 INTERFACE IMPORTED) set_target_properties(CURL::ngtcp2 PROPERTIES diff --git a/CMake/FindNettle.cmake b/CMake/FindNettle.cmake index d22865ffad..c963180cba 100644 --- a/CMake/FindNettle.cmake +++ b/CMake/FindNettle.cmake @@ -85,10 +85,6 @@ else() endif() if(NETTLE_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_nettle_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::nettle) add_library(CURL::nettle INTERFACE IMPORTED) set_target_properties(CURL::nettle PROPERTIES diff --git a/CMake/FindQuiche.cmake b/CMake/FindQuiche.cmake index 22482d79fb..137679b5b3 100644 --- a/CMake/FindQuiche.cmake +++ b/CMake/FindQuiche.cmake @@ -68,10 +68,6 @@ else() endif() if(QUICHE_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_quiche_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::quiche) add_library(CURL::quiche INTERFACE IMPORTED) set_target_properties(CURL::quiche PROPERTIES diff --git a/CMake/FindRustls.cmake b/CMake/FindRustls.cmake index 270e99c6d5..1e07565189 100644 --- a/CMake/FindRustls.cmake +++ b/CMake/FindRustls.cmake @@ -104,10 +104,6 @@ if(RUSTLS_FOUND) mark_as_advanced(MATH_LIBRARY) endif() - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_rustls_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::rustls) add_library(CURL::rustls INTERFACE IMPORTED) set_target_properties(CURL::rustls PROPERTIES diff --git a/CMake/FindWolfSSL.cmake b/CMake/FindWolfSSL.cmake index 3a3c05f0fd..606a67b8be 100644 --- a/CMake/FindWolfSSL.cmake +++ b/CMake/FindWolfSSL.cmake @@ -113,10 +113,6 @@ if(WOLFSSL_FOUND) mark_as_advanced(MATH_LIBRARY) endif() - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_wolfssl_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::wolfssl) add_library(CURL::wolfssl INTERFACE IMPORTED) set_target_properties(CURL::wolfssl PROPERTIES diff --git a/CMake/FindZstd.cmake b/CMake/FindZstd.cmake index baf6148f0d..20da805249 100644 --- a/CMake/FindZstd.cmake +++ b/CMake/FindZstd.cmake @@ -110,10 +110,6 @@ else() endif() if(ZSTD_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.13) - link_directories(${_zstd_LIBRARY_DIRS}) - endif() - if(NOT TARGET CURL::zstd) add_library(CURL::zstd INTERFACE IMPORTED) set_target_properties(CURL::zstd PROPERTIES diff --git a/CMake/curl-config.in.cmake b/CMake/curl-config.in.cmake index 4d7d0fd1ed..a6fc349f2a 100644 --- a/CMake/curl-config.in.cmake +++ b/CMake/curl-config.in.cmake @@ -55,7 +55,7 @@ if("@HAVE_LIBZ@") endif() set(_curl_cmake_module_path_save ${CMAKE_MODULE_PATH}) -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH}) +list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) set(_curl_libs "") @@ -158,35 +158,9 @@ include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") # Alias for either shared or static library if(NOT TARGET @PROJECT_NAME@::@LIB_NAME@) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.11 AND CMAKE_VERSION VERSION_LESS 3.18) - set_target_properties(@PROJECT_NAME@::@LIB_SELECTED@ PROPERTIES IMPORTED_GLOBAL TRUE) - endif() add_library(@PROJECT_NAME@::@LIB_NAME@ ALIAS @PROJECT_NAME@::@LIB_SELECTED@) endif() -if(TARGET @PROJECT_NAME@::@LIB_STATIC@) - # CMake before CMP0099 (CMake 3.17 2020-03-20) did not propagate libdirs to - # targets. It expected libs to have an absolute filename. As a workaround, - # manually apply dependency libdirs, for CMake consumers without this policy. - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17) - cmake_policy(GET CMP0099 _has_CMP0099) # https://cmake.org/cmake/help/latest/policy/CMP0099.html - endif() - if(NOT _has_CMP0099 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 AND _curl_libs) - set(_curl_libdirs "") - foreach(_curl_lib IN LISTS _curl_libs) - if(TARGET "${_curl_lib}") - get_target_property(_curl_libdir "${_curl_lib}" INTERFACE_LINK_DIRECTORIES) - if(_curl_libdir) - list(APPEND _curl_libdirs "${_curl_libdir}") - endif() - endif() - endforeach() - if(_curl_libdirs) - target_link_directories(@PROJECT_NAME@::@LIB_STATIC@ INTERFACE ${_curl_libdirs}) - endif() - endif() -endif() - # For compatibility with CMake's FindCURL.cmake set(CURL_VERSION_STRING "@CURLVERSION@") set(CURL_LIBRARIES @PROJECT_NAME@::@LIB_NAME@) diff --git a/CMakeLists.txt b/CMakeLists.txt index df9ff533e5..8831937b8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ # ########################################################################### -cmake_minimum_required(VERSION 3.7...3.16 FATAL_ERROR) +cmake_minimum_required(VERSION 3.18 FATAL_ERROR) message(STATUS "Using CMake version ${CMAKE_VERSION}") # Collect command-line arguments for buildinfo.txt. @@ -45,7 +45,7 @@ if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "") endforeach() endif() -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) +list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake") include(Utilities) include(Macros) include(CMakeDependentOption) @@ -324,18 +324,10 @@ set(CURL_CFLAGS "") # C flags set for libcurl and curl tool (aka public binarie option(CURL_DROP_UNUSED "Drop unused code and data from built binaries" OFF) if(CURL_DROP_UNUSED) if(APPLE) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - set_property(DIRECTORY APPEND PROPERTY LINK_OPTIONS "-Wl,-dead_strip") - else() - set_property(DIRECTORY APPEND PROPERTY LINK_FLAGS "-Wl,-dead_strip") - endif() + set_property(DIRECTORY APPEND PROPERTY LINK_OPTIONS "-Wl,-dead_strip") elseif(MSVC) # Options below are toolchain defaults in Release configurations. # This option does not seem to have an effect with VS2010: - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - set_property(DIRECTORY APPEND PROPERTY LINK_OPTIONS "-OPT:REF") - else() - set_property(DIRECTORY APPEND PROPERTY LINK_FLAGS "-OPT:REF") - endif() + set_property(DIRECTORY APPEND PROPERTY LINK_OPTIONS "-OPT:REF") # Optional, but reduces binary size further, with the cost of larger objects/static libraries: list(APPEND CURL_CFLAGS "-Gy") elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") @@ -343,11 +335,7 @@ if(CURL_DROP_UNUSED) # To make -Wl,--gc-sections work on Windows: https://sourceware.org/bugzilla/show_bug.cgi?id=11539 set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-fno-asynchronous-unwind-tables") endif() - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - set_property(DIRECTORY APPEND PROPERTY LINK_OPTIONS "-Wl,--gc-sections") - else() - set_property(DIRECTORY APPEND PROPERTY LINK_FLAGS "-Wl,--gc-sections") - endif() + set_property(DIRECTORY APPEND PROPERTY LINK_OPTIONS "-Wl,--gc-sections") # Optional, but reduces binary size further, with the cost of larger objects/static libraries: list(APPEND CURL_CFLAGS "-ffunction-sections" "-fdata-sections") endif() @@ -678,7 +666,7 @@ elseif(AMIGA) elseif(NOT WIN32 AND NOT APPLE) check_library_exists("socket" "connect" "" HAVE_LIBSOCKET) if(HAVE_LIBSOCKET) - set(CURL_NETWORK_AND_TIME_LIBS "socket" ${CURL_NETWORK_AND_TIME_LIBS}) + list(PREPEND CURL_NETWORK_AND_TIME_LIBS "socket") endif() endif() @@ -1194,7 +1182,7 @@ if(NOT CURL_DISABLE_LDAP) find_package(LDAP MODULE) if(LDAP_FOUND) set(HAVE_LBER_H 1) - set(CURL_LIBS CURL::ldap ${CURL_LIBS}) + list(PREPEND CURL_LIBS CURL::ldap) # LDAP feature checks @@ -1261,7 +1249,7 @@ set(HAVE_LIBIDN2 OFF) if(USE_LIBIDN2 AND NOT USE_APPLE_IDN AND NOT USE_WIN32_IDN) find_package(Libidn2 MODULE) if(LIBIDN2_FOUND) - set(CURL_LIBS CURL::libidn2 ${CURL_LIBS}) + list(PREPEND CURL_LIBS CURL::libidn2) set(HAVE_IDN2_H 1) set(HAVE_LIBIDN2 1) endif() @@ -1284,7 +1272,7 @@ set(USE_LIBSSH2 OFF) if(CURL_USE_LIBSSH2) find_package(Libssh2 MODULE) if(LIBSSH2_FOUND) - set(CURL_LIBS CURL::libssh2 ${CURL_LIBS}) # keep it before TLS-crypto, compression + list(PREPEND CURL_LIBS CURL::libssh2) # keep it before TLS-crypto, compression set(USE_LIBSSH2 ON) endif() endif() @@ -1294,7 +1282,7 @@ option(CURL_USE_LIBSSH "Use libssh" OFF) mark_as_advanced(CURL_USE_LIBSSH) if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH) find_package(Libssh MODULE REQUIRED) - set(CURL_LIBS CURL::libssh ${CURL_LIBS}) # keep it before TLS-crypto, compression + list(PREPEND CURL_LIBS CURL::libssh) # keep it before TLS-crypto, compression set(USE_LIBSSH ON) endif() @@ -1870,12 +1858,6 @@ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") # MSVC but exclude clang-cl endif() if(CURL_LTO) - if(CMAKE_VERSION VERSION_LESS 3.9) - message(FATAL_ERROR "LTO has been requested, but your cmake version ${CMAKE_VERSION} is to old. You need at least 3.9") - endif() - - cmake_policy(SET CMP0069 NEW) - include(CheckIPOSupported) check_ipo_supported(RESULT CURL_HAS_LTO OUTPUT _lto_error LANGUAGES C) if(CURL_HAS_LTO) @@ -2051,11 +2033,7 @@ curl_add_if("SSLS-EXPORT" _ssl_enabled AND USE_SSLS_EXPORT) curl_add_if("AppleSecTrust" USE_APPLE_SECTRUST AND _ssl_enabled AND (USE_OPENSSL OR USE_GNUTLS)) curl_add_if("NativeCA" NOT USE_APPLE_SECTRUST AND _ssl_enabled AND CURL_CA_NATIVE) if(_items) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - list(SORT _items CASE INSENSITIVE) - else() - list(SORT _items) - endif() + list(SORT _items CASE INSENSITIVE) endif() set(CURL_SUPPORTED_FEATURES_LIST "${_items}") string(REPLACE ";" " " SUPPORT_FEATURES "${_items}") @@ -2071,11 +2049,7 @@ curl_add_if("GnuTLS" _ssl_enabled AND USE_GNUTLS) curl_add_if("Rustls" _ssl_enabled AND USE_RUSTLS) if(_items) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - list(SORT _items CASE INSENSITIVE) - else() - list(SORT _items) - endif() + list(SORT _items CASE INSENSITIVE) endif() string(REPLACE ";" " " SSL_BACKENDS "${_items}") message(STATUS "Enabled SSL backends: ${SSL_BACKENDS}") diff --git a/appveyor.sh b/appveyor.sh index 03d7e42642..a69fae7742 100644 --- a/appveyor.sh +++ b/appveyor.sh @@ -70,28 +70,17 @@ if [ -n "${CMAKE_GENERATOR:-}" ]; then [ "${_chkprefill}" = '_chkprefill' ] && options+=' -D_CURL_PREFILL=OFF' [[ "${CMAKE_GENERATE:-}" = *'-A ARM64'* ]] && SKIP_RUN='ARM64 architecture' [[ "${CMAKE_GENERATE:-}" = *'-DCURL_USE_OPENSSL=ON'* ]] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}" - if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ]; then - mkdir "_bld${_chkprefill}" - cd "_bld${_chkprefill}" - options+=' ..' - root='..' - else - options+=" -B _bld${_chkprefill}" - options+=' -DCMAKE_VS_GLOBALS=TrackFileAccess=false' - options+=' -DCMAKE_UNITY_BUILD=ON' - root='.' - fi - # CMAKE_GENERATOR env requires CMake 3.15+, pass it manually to make it work with older versions. # shellcheck disable=SC2086 - time cmake -G "${CMAKE_GENERATOR}" \ - -DENABLE_DEBUG=ON -DCURL_WERROR=ON \ + time cmake -B "_bld${_chkprefill}" \ + -DENABLE_DEBUG=ON \ + -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON \ + -DCMAKE_VS_GLOBALS=TrackFileAccess=false \ -DCURL_STATIC_CRT=ON \ -DCURL_DROP_UNUSED=ON \ -DCURL_USE_SCHANNEL=ON -DCURL_USE_LIBPSL=OFF \ - ${options} \ ${CMAKE_GENERATE:-} \ - || { cat "${root}"/_bld/CMakeFiles/CMake* 2>/dev/null; false; } - [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ] && cd .. + ${options} \ + || { cat _bld/CMakeFiles/CMake* 2>/dev/null; false; } done if [ -d _bld_chkprefill ] && ! diff -u _bld/lib/curl_config.h _bld_chkprefill/lib/curl_config.h; then cat _bld_chkprefill/CMakeFiles/CMake* 2>/dev/null || true diff --git a/appveyor.yml b/appveyor.yml index d3444d9491..c33717c4e9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -45,12 +45,16 @@ environment: CMAKE_GENERATE: '-A ARM64 -DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=OFF' - job_name: 'CM VS2010, Debug, x64, Schannel, Shared, Build-tests & examples' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2013' + APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' + CMAKE_VERSION: 3.18.4 + CMAKE_SHA256: a932bc0c8ee79f1003204466c525b38a840424d4ae29f9e5fb88959116f2407d CMAKE_GENERATOR: 'Visual Studio 10 2010' CMAKE_GENERATE: '-A x64' - job_name: 'CM VS2012, Release, x86, Schannel, Shared, Build-tests' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' + CMAKE_VERSION: 3.21.7 + CMAKE_SHA256: 4c4840e2dc2bf82e8a16081ff506bba54f3a228b91ce36317129fed4035ef2e3 CMAKE_GENERATOR: 'Visual Studio 11 2012' CMAKE_GENERATE: '-A Win32' diff --git a/docs/DEPRECATE.md b/docs/DEPRECATE.md index d8984a07e6..e0010d7aeb 100644 --- a/docs/DEPRECATE.md +++ b/docs/DEPRECATE.md @@ -28,12 +28,6 @@ RTMP in curl is powered by the 3rd party library librtmp. Support for RTMP in libcurl gets removed in April 2026. -## CMake 3.17 and earlier - -We remove support for CMake <3.18 in April 2026. - -CMake 3.18 was released on 2020-07-15. - ## TLS-SRP Authentication Transport Layer Security Secure Remote Password is a TLS feature that does not @@ -78,3 +72,4 @@ After curl 8.19.0 NTLM support becomes opt-in. - OpenSSL 1.1.1 and older (removed in 8.18.0) - Support for Windows XP (removed in 8.19.0) - OpenSSL-QUIC (removed in 8.19.0) +- CMake 3.17 and older (removed in 8.21.0) diff --git a/docs/INSTALL-CMAKE.md b/docs/INSTALL-CMAKE.md index 75cfceb872..eac461c576 100644 --- a/docs/INSTALL-CMAKE.md +++ b/docs/INSTALL-CMAKE.md @@ -43,20 +43,6 @@ that is apart from the source tree. For the full list of CMake build configuration variables see [the corresponding section](#cmake-build-options). -### Fallback for CMake before version 3.13 - -CMake before version 3.13 does not support the `-B` option. In that case, -you must create the build directory yourself, `cd` to it and run `cmake` -from there: - - $ mkdir ../curl-build - $ cd ../curl-build - $ cmake ../curl - -If you want to build in the source tree, it is enough to do this: - - $ cmake . - ### Build system generator selection You can override CMake's default by using `-G `. For example diff --git a/docs/INTERNALS.md b/docs/INTERNALS.md index 3a21ad678b..8c9419f347 100644 --- a/docs/INTERNALS.md +++ b/docs/INTERNALS.md @@ -50,7 +50,7 @@ we use a few "build tools" and we make sure that we remain functional with these versions: - clang-tidy 17.0.0 (2023-09-19), recommended: 19.1.0 or later (2024-09-17) -- cmake 3.7 (2016-11-11) +- cmake 3.18 (2020-07-15) - GNU autoconf 2.59 (2003-11-06) - GNU automake 1.7 (2002-09-25) - GNU libtool 1.4.2 (2001-09-11) diff --git a/docs/examples/CMakeLists.txt b/docs/examples/CMakeLists.txt index f1178ad35e..dc3313d6a2 100644 --- a/docs/examples/CMakeLists.txt +++ b/docs/examples/CMakeLists.txt @@ -41,21 +41,13 @@ foreach(_target IN LISTS COMPLICATED_MAY_BUILD check_PROGRAMS _all) # keep 'COM set(_more_libs "") set(_target_name "curl-example-${_target}") if(_target STREQUAL "all") - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) - add_library(${_target_name} OBJECT EXCLUDE_FROM_ALL ${_all_src}) - if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") # MSVC but exclude clang-cl - # CMake generates a static library for the OBJECT target. Silence these 'lib.exe' warnings: - # warning LNK4006: main already defined in ....obj; second definition ignored - # warning LNK4221: This object file does not define any previously undefined public symbols, - # [...] not be used by any link operation that consumes this library - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - set_target_properties(${_target_name} PROPERTIES STATIC_LIBRARY_OPTIONS "-ignore:4006;-ignore:4221") - else() - set_target_properties(${_target_name} PROPERTIES STATIC_LIBRARY_FLAGS "-ignore:4006 -ignore:4221") - endif() - endif() - else() - add_library(${_target_name} STATIC EXCLUDE_FROM_ALL ${_all_src}) + add_library(${_target_name} OBJECT EXCLUDE_FROM_ALL ${_all_src}) + if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") # MSVC but exclude clang-cl + # CMake generates a static library for the OBJECT target. Silence these 'lib.exe' warnings: + # warning LNK4006: main already defined in ....obj; second definition ignored + # warning LNK4221: This object file does not define any previously undefined public symbols, + # [...] not be used by any link operation that consumes this library + set_target_properties(${_target_name} PROPERTIES STATIC_LIBRARY_OPTIONS "-ignore:4006;-ignore:4221") endif() if(_with_deps) set(_more_libs ${CURL_LIBS}) # If any examples required dependencies, link them diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 7384844960..1b6f6b36ba 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -99,9 +99,9 @@ if(NOT DEFINED SHARE_LIB_OBJECT) endif() endif() -if(SHARE_LIB_OBJECT AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) +if(SHARE_LIB_OBJECT) set(LIB_OBJECT "libcurl_object") - add_library(${LIB_OBJECT} OBJECT ${HHEADERS} ${CSOURCES}) # Requires CMake 3.12 + add_library(${LIB_OBJECT} OBJECT ${HHEADERS} ${CSOURCES}) if(WIN32) # Define CURL_STATICLIB always, to disable __declspec(dllexport) for # exported libcurl symbols. We handle exports via libcurl.def instead. @@ -194,27 +194,6 @@ if(BUILD_STATIC_LIBS) target_include_directories(${LIB_STATIC} INTERFACE "$" "$") - - # CMake before CMP0099 (CMake 3.17 2020-03-20) did not propagate libdirs to - # targets. It expected libs to have an absolute filename. As a workaround, - # manually apply dependency libdirs, for CMake consumers without this policy. - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17) - cmake_policy(GET CMP0099 _has_CMP0099) # https://cmake.org/cmake/help/latest/policy/CMP0099.html - endif() - if(NOT _has_CMP0099 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 AND CURL_LIBS) - set(_curl_libdirs "") - foreach(_curl_lib IN LISTS CURL_LIBS) - if(TARGET "${_curl_lib}") - get_target_property(_curl_libdir "${_curl_lib}" INTERFACE_LINK_DIRECTORIES) - if(_curl_libdir) - list(APPEND _curl_libdirs "${_curl_libdir}") - endif() - endif() - endforeach() - if(_curl_libdirs) - target_link_directories(${LIB_STATIC} INTERFACE ${_curl_libdirs}) - endif() - endif() endif() if(BUILD_SHARED_LIBS) @@ -258,11 +237,7 @@ if(BUILD_SHARED_LIBS) if(CURL_CODE_COVERAGE) set_property(TARGET ${LIB_SHARED} APPEND PROPERTY COMPILE_DEFINITIONS ${CURL_COVERAGE_MACROS}) set_property(TARGET ${LIB_SHARED} APPEND PROPERTY COMPILE_OPTIONS ${CURL_COVERAGE_CFLAGS}) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - set_property(TARGET ${LIB_SHARED} APPEND PROPERTY LINK_OPTIONS ${CURL_COVERAGE_LDFLAGS}) - else() - set_property(TARGET ${LIB_SHARED} APPEND PROPERTY LINK_FLAGS ${CURL_COVERAGE_LDFLAGS}) - endif() + set_property(TARGET ${LIB_SHARED} APPEND PROPERTY LINK_OPTIONS ${CURL_COVERAGE_LDFLAGS}) endif() target_include_directories(${LIB_SHARED} INTERFACE @@ -337,11 +312,7 @@ if(BUILD_SHARED_LIBS) set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libcurl.vers") check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSIONED_SYMBOLS) if(HAVE_VERSIONED_SYMBOLS) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - set_property(TARGET ${LIB_SHARED} APPEND PROPERTY LINK_OPTIONS "${CMAKE_REQUIRED_LINK_OPTIONS}") - else() - set_property(TARGET ${LIB_SHARED} APPEND PROPERTY LINK_FLAGS "${CMAKE_REQUIRED_LINK_OPTIONS}") - endif() + set_property(TARGET ${LIB_SHARED} APPEND PROPERTY LINK_OPTIONS "${CMAKE_REQUIRED_LINK_OPTIONS}") else() message(WARNING "Versioned symbols requested, but not supported by the toolchain.") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2260ae3923..1f76839009 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -130,21 +130,13 @@ if(CURL_ANALYZER_CFLAGS) endif() if(ENABLE_UNICODE AND MINGW) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - set_property(TARGET ${EXE_NAME} APPEND PROPERTY LINK_OPTIONS "-municode") - else() - set_property(TARGET ${EXE_NAME} APPEND PROPERTY LINK_FLAGS "-municode") - endif() + set_property(TARGET ${EXE_NAME} APPEND PROPERTY LINK_OPTIONS "-municode") endif() if(CURL_CODE_COVERAGE) set_property(TARGET ${EXE_NAME} APPEND PROPERTY COMPILE_DEFINITIONS ${CURL_COVERAGE_MACROS}) set_property(TARGET ${EXE_NAME} APPEND PROPERTY COMPILE_OPTIONS ${CURL_COVERAGE_CFLAGS}) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - set_property(TARGET ${EXE_NAME} APPEND PROPERTY LINK_OPTIONS ${CURL_COVERAGE_LDFLAGS}) - else() - set_property(TARGET ${EXE_NAME} APPEND PROPERTY LINK_FLAGS ${CURL_COVERAGE_LDFLAGS}) - endif() + set_property(TARGET ${EXE_NAME} APPEND PROPERTY LINK_OPTIONS ${CURL_COVERAGE_LDFLAGS}) endif() ################################################################################ diff --git a/tests/cmake/CMakeLists.txt b/tests/cmake/CMakeLists.txt index 684759a4e6..fed5eb0d6d 100644 --- a/tests/cmake/CMakeLists.txt +++ b/tests/cmake/CMakeLists.txt @@ -22,7 +22,7 @@ # ########################################################################### -cmake_minimum_required(VERSION 3.7...3.16 FATAL_ERROR) +cmake_minimum_required(VERSION 3.18 FATAL_ERROR) message(STATUS "Using CMake version ${CMAKE_VERSION}") option(TEST_CPP "Test C++" OFF) @@ -70,9 +70,6 @@ elseif(TEST_INTEGRATION_MODE STREQUAL "add_subdirectory") set(BUILD_STATIC_LIBS ON CACHE BOOL "") add_subdirectory(curl) elseif(TEST_INTEGRATION_MODE STREQUAL "FetchContent") - if(CMAKE_VERSION VERSION_LESS 3.14) - message(FATAL_ERROR "This test requires CMake 3.14 or upper") - endif() include(FetchContent) option(FROM_GIT_REPO "Git URL" "https://github.com/curl/curl.git") option(FROM_GIT_TAG "Git tag" "master") @@ -82,7 +79,7 @@ elseif(TEST_INTEGRATION_MODE STREQUAL "FetchContent") GIT_SHALLOW) set(BUILD_SHARED_LIBS ON CACHE BOOL "") set(BUILD_STATIC_LIBS ON CACHE BOOL "") - FetchContent_MakeAvailable(curl) # Requires CMake 3.14 + FetchContent_MakeAvailable(curl) elseif(TEST_INTEGRATION_MODE STREQUAL "ExternalProject") include(ExternalProject) set(_curl_install_dir "${CMAKE_BINARY_DIR}/curl-external-install") diff --git a/tests/cmake/test.sh b/tests/cmake/test.sh index ef49aa632d..bcc1bd37dc 100755 --- a/tests/cmake/test.sh +++ b/tests/cmake/test.sh @@ -14,19 +14,7 @@ mode="${1:-all}"; shift cmake_consumer="${TEST_CMAKE_CONSUMER:-cmake}" cmake_provider="${TEST_CMAKE_PROVIDER:-${cmake_consumer}}" -# 'modern': supports -S/-B (3.13+), --install (3.15+) -"${cmake_consumer}" --help | grep -q -- '--install' && cmake_consumer_modern=1 -"${cmake_provider}" --help | grep -q -- '--install' && cmake_provider_modern=1 - -if [ -n "${TEST_CMAKE_GENERATOR:-}" ]; then - gen="${TEST_CMAKE_GENERATOR}" -elif [ -n "${cmake_consumer_modern:-}" ] && \ - [ -n "${cmake_provider_modern:-}" ] && \ - command -v ninja >/dev/null; then - gen='Ninja' # 3.17+ -else - gen='Unix Makefiles' -fi +gen="${TEST_CMAKE_GENERATOR:-Ninja}" cmake_opts='-DBUILD_CURL_EXE=OFF -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF' @@ -47,23 +35,14 @@ if [ "${mode}" = 'all' ] || [ "${mode}" = 'ExternalProject' ]; then sha="$(sha256sum "${src}" | grep -a -i -o -w -E '[0-9a-f]{64}')" bldc='bld-externalproject' rm -rf "${bldc}" - if [ -n "${cmake_consumer_modern:-}" ]; then # 3.15+ - "${cmake_consumer}" -B "${bldc}" -G "${gen}" ${TEST_CMAKE_FLAGS:-} -DCURL_TEST_OPTS="${cmake_opts} -DCMAKE_UNITY_BUILD=ON $*" \ - -DTEST_INTEGRATION_MODE=ExternalProject \ - -DFROM_ARCHIVE="${src}" -DFROM_HASH="${sha}" - "${cmake_consumer}" --build "${bldc}" --verbose - else - mkdir "${bldc}"; cd "${bldc}" - "${cmake_consumer}" .. -G "${gen}" ${TEST_CMAKE_FLAGS:-} -DCURL_TEST_OPTS="${cmake_opts} $*" \ - -DTEST_INTEGRATION_MODE=ExternalProject \ - -DFROM_ARCHIVE="${src}" -DFROM_HASH="${sha}" - VERBOSE=1 "${cmake_consumer}" --build . - cd .. - fi + "${cmake_consumer}" -B "${bldc}" -G "${gen}" ${TEST_CMAKE_FLAGS:-} -DCURL_TEST_OPTS="${cmake_opts} -DCMAKE_UNITY_BUILD=ON $*" \ + -DTEST_INTEGRATION_MODE=ExternalProject \ + -DFROM_ARCHIVE="${src}" -DFROM_HASH="${sha}" + "${cmake_consumer}" --build "${bldc}" --verbose runresults "${bldc}" fi -if [ "${mode}" = 'all' ] || [ "${mode}" = 'FetchContent' ]; then # 3.14+ +if [ "${mode}" = 'all' ] || [ "${mode}" = 'FetchContent' ]; then src="${PWD}/${src}" bldc='bld-fetchcontent' rm -rf "${bldc}" @@ -83,19 +62,9 @@ if [ "${mode}" = 'all' ] || [ "${mode}" = 'add_subdirectory' ]; then fi bldc='bld-add_subdirectory' rm -rf "${bldc}" - if [ -n "${cmake_consumer_modern:-}" ]; then # 3.15+ - "${cmake_consumer}" -B "${bldc}" -G "${gen}" ${cmake_opts} -DCMAKE_UNITY_BUILD=ON ${TEST_CMAKE_FLAGS:-} "$@" \ - -DTEST_INTEGRATION_MODE=add_subdirectory - "${cmake_consumer}" --build "${bldc}" --verbose - else - mkdir "${bldc}"; cd "${bldc}" - # Disable `pkg-config` for CMake <= 3.12. These versions cannot propagate - # library directories to the consumer project. - "${cmake_consumer}" .. -G "${gen}" ${cmake_opts} -DCURL_USE_PKGCONFIG=OFF ${TEST_CMAKE_FLAGS:-} "$@" \ - -DTEST_INTEGRATION_MODE=add_subdirectory - VERBOSE=1 "${cmake_consumer}" --build . - cd .. - fi + "${cmake_consumer}" -B "${bldc}" -G "${gen}" ${cmake_opts} -DCMAKE_UNITY_BUILD=ON ${TEST_CMAKE_FLAGS:-} "$@" \ + -DTEST_INTEGRATION_MODE=add_subdirectory + "${cmake_consumer}" --build "${bldc}" --verbose PATH="${bldc}/curl/lib:${PATH}" runresults "${bldc}" fi @@ -105,41 +74,21 @@ if [ "${mode}" = 'all' ] || [ "${mode}" = 'find_package' ]; then bldp='bld-curl' prefix="${PWD}/${bldp}/_pkg" rm -rf "${bldp}" - if [ -n "${cmake_provider_modern:-}" ]; then # 3.15+ - "${cmake_provider}" -B "${bldp}" -S "${src}" -G "${gen}" ${cmake_opts} -DCMAKE_UNITY_BUILD=ON ${TEST_CMAKE_FLAGS:-} ${TEST_CMAKE_FLAGS_PROVIDER:-} "$@" \ - -DBUILD_SHARED_LIBS=ON \ - -DBUILD_STATIC_LIBS=ON \ - -DCMAKE_INSTALL_PREFIX="${prefix}" - "${cmake_provider}" --build "${bldp}" --verbose - "${cmake_provider}" --install "${bldp}" - else - mkdir "${bldp}"; cd "${bldp}" - "${cmake_provider}" "${src}" -G "${gen}" ${cmake_opts} ${TEST_CMAKE_FLAGS:-} ${TEST_CMAKE_FLAGS_PROVIDER:-} "$@" \ - -DBUILD_SHARED_LIBS=ON \ - -DBUILD_STATIC_LIBS=ON \ - -DCMAKE_INSTALL_PREFIX="${prefix}" - VERBOSE=1 "${cmake_provider}" --build . - make install - cd .. - fi + "${cmake_provider}" -B "${bldp}" -S "${src}" -G "${gen}" ${cmake_opts} -DCMAKE_UNITY_BUILD=ON ${TEST_CMAKE_FLAGS:-} ${TEST_CMAKE_FLAGS_PROVIDER:-} "$@" \ + -DBUILD_SHARED_LIBS=ON \ + -DBUILD_STATIC_LIBS=ON \ + -DCMAKE_INSTALL_PREFIX="${prefix}" + "${cmake_provider}" --build "${bldp}" --verbose + "${cmake_provider}" --install "${bldp}" echo '::group::libcurl.pc'; cat "${prefix}"/lib/pkgconfig/*.pc || true; echo '::endgroup::' echo '::group::curl-config.cmake'; cat "${prefix}"/lib/cmake/CURL/CURL* || true; echo '::endgroup::' echo '::group::curl-config'; cat "${prefix}"/bin/curl-config || true; echo '::endgroup::' bldc='bld-find_package' rm -rf "${bldc}" - if [ -n "${cmake_consumer_modern:-}" ]; then # 3.15+ - "${cmake_consumer}" -B "${bldc}" -G "${gen}" ${TEST_CMAKE_FLAGS:-} ${TEST_CMAKE_FLAGS_CONSUMER:-} \ - -DTEST_INTEGRATION_MODE=find_package \ - -DCMAKE_PREFIX_PATH="${prefix}/lib/cmake/CURL" - "${cmake_consumer}" --build "${bldc}" --verbose - else - mkdir "${bldc}"; cd "${bldc}" - "${cmake_consumer}" .. -G "${gen}" ${TEST_CMAKE_FLAGS:-} ${TEST_CMAKE_FLAGS_CONSUMER:-} \ - -DTEST_INTEGRATION_MODE=find_package \ - -DCMAKE_PREFIX_PATH="${prefix}/lib/cmake/CURL" - VERBOSE=1 "${cmake_consumer}" --build . - cd .. - fi + "${cmake_consumer}" -B "${bldc}" -G "${gen}" ${TEST_CMAKE_FLAGS:-} ${TEST_CMAKE_FLAGS_CONSUMER:-} \ + -DTEST_INTEGRATION_MODE=find_package \ + -DCMAKE_PREFIX_PATH="${prefix}/lib/cmake/CURL" + "${cmake_consumer}" --build "${bldc}" --verbose PATH="${prefix}/bin:${PATH}" runresults "${bldc}" fi