Skip to content

cmake: drop support for CMake 3.17 and older - #20407

Closed
vszakats wants to merge 33 commits into
curl:masterfrom
vszakats:cm318
Closed

vszakats wants to merge 33 commits into
curl:masterfrom
vszakats:cm318

Conversation

@vszakats

@vszakats vszakats commented Jan 23, 2026 •

Copy link
Copy Markdown
Member

Require CMake 3.18 (2020-07-15) or newer, up from 3.7 (2016-11-11)
prior to this patch.

This requirement also applies to the distributed curl-config.cmake.

To allow dropping compatibility code maintained for old versions, and to
use features which were unpractical in separate code paths. Also to make
testing, documentation and development easier, CI builds faster due to
CMake performance improvements over time. (e.g. integration tests on
macOS run 8x faster (10 minutes is now under 1.5m) in CI, 2.5x faster on
Windows.)

CMake offers pre-built binaries for major platforms. They work without
an install step, just by unpacking and pointing the cmake command to
them. Making upgrades easy in many cases:
https://cmake.org/download/
https://cmake.org/files/
https://github.com/Kitware/CMake/releases

CMake 3.18 brings these feature as generally available when building or
consuming curl/libcurl:

LTO support, improved performance, pkg-config and interface target
support, OBJECT target (for faster libcurl builds), modern invocation
with -S/-B options, better support for custom linker options,
FetchContent, GnuTLS::GnuTLS target, --verbose and --install
options, CMAKE_GENERATOR env, last but not least unity mode and Ninja
generator.

For maximum build speed, use:
-DCMAKE_UNITY_BUILD=ON -DCURL_DROP_UNUSED=ON

As for deprecations, C++11 is required to build CMake itself, which may
be a limit on some platforms. autotools continues to cover them.

Follow-up to 9bcdfb3 #20408
Follow-up to a7c974e #19902
Follow-up to dfbe035 #10161
Discussion: #18704


https://github.com/curl/curl/pull/20407/files?w=1

AppVeyor CI VS2010 job: 1m36s → 1m3s (v3.12.2 → v3.18.4)
before: https://ci.appveyor.com/project/curlorg/curl/builds/53416108/job/q636op5yiartyaek
after: https://ci.appveyor.com/project/curlorg/curl/builds/53418781/job/axv5i6brwn39rwle

@vszakats vszakats added the cmake label Jan 23, 2026
@github-actions github-actions Bot added cmdline tool tests CI Continuous Integration labels Jan 23, 2026
vszakats added a commit that referenced this pull request Jan 23, 2026
Bump CMake version in CMake integration tests for better performance
(8x on macOS, 2-3x on Windows) and native arm64 binaries.

- bump old CMake in integration tests to v3.19.8 (was: v3.11.4)
- switch to native arm64 CMake binaries on macOS.
- switch Linux CMake integration job to arm64.

Speed gains:
- Linux: 2m -> 1m30s
- macOS: 9-10m -> 1m15s
- Windows: 6-7m -> 2m43s

Before:
https://github.com/curl/curl/actions/runs/21255697172
https://github.com/curl/curl/actions/runs/21255020621

After:
https://github.com/curl/curl/actions/runs/21272021446

With this, CI is:
- no longer testing deprecated CMake versions.
  Follow-up to a7c974e #19902
- not testing the next (from 2026 April) minimum 3.18, but going for
  3.19 instead. For arm64 binaries on both macOS and Linux. There is
  no 3.18-specific CMake code in curl.

Cherry-picked from #20407
Closes #20408
@vszakats vszakats added the feature-window A merge of this requires an open feature window label Jan 28, 2026
vszakats added a commit to vszakats/curl that referenced this pull request Feb 5, 2026
vszakats added a commit that referenced this pull request Feb 5, 2026
vszakats added a commit that referenced this pull request Feb 5, 2026
@vszakats vszakats changed the title cmake: drop support for CMake 3.17 and older cmake: require CMake 3.18 or newer Feb 5, 2026
@vszakats vszakats changed the title cmake: require CMake 3.18 or newer cmake: drop support for CMake 3.17 and older Feb 5, 2026
@vszakats
vszakats force-pushed the cm318 branch 2 times, most recently from f7a68d4 to c0549c6 Compare February 25, 2026 13:50
@vszakats
vszakats force-pushed the cm318 branch 3 times, most recently from d6f26b1 to b15aa51 Compare March 4, 2026 20:42
@vszakats vszakats closed this in 89043ba Mar 21, 2026
@vszakats
vszakats deleted the cm318 branch March 21, 2026 12:26
vszakats added a commit that referenced this pull request May 26, 2026
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
Require CMake 3.18 (2020-07-15) or newer, up from 3.7 (2016-11-11)
prior to this patch.

This requirement also applies to the distributed `curl-config.cmake`.

To allow dropping compatibility code maintained for old versions, and to
use features which were unpractical in separate code paths. Also to make
testing, documentation and development easier, CI builds faster due to
CMake performance improvements over time. (e.g. integration tests on
macOS run 8x faster (10 minutes is now under 1.5m) in CI, 2.5x faster on
Windows.)

CMake offers pre-built binaries for major platforms. They work without
an install step, just by unpacking and pointing the cmake command to
them. Making upgrades easy in many cases:
https://cmake.org/download/
https://cmake.org/files/
https://github.com/Kitware/CMake/releases

CMake 3.18 brings these feature as generally available when building or
consuming curl/libcurl:

LTO support, improved performance, `pkg-config` and interface target
support, `OBJECT` target (for faster libcurl builds), modern invocation
with `-S`/`-B` options, better support for custom linker options,
FetchContent, `GnuTLS::GnuTLS` target, `--verbose` and `--install`
options, `CMAKE_GENERATOR` env, last but not least unity mode and Ninja
generator.

For maximum build speed, use:
`-DCMAKE_UNITY_BUILD=ON -DCURL_DROP_UNUSED=ON`

As for deprecations, C++11 is required to build CMake itself, which may
be a limit on some platforms. autotools continues to cover them.

Follow-up to 9bcdfb3 curl#20408
Follow-up to a7c974e curl#19902
Follow-up to dfbe035 curl#10161
Discussion: curl#18704

Closes curl#20407
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
vszakats added a commit that referenced this pull request Jun 17, 2026
Redundant since bumping minimum to 3.18.

Follow-up to 89043ba #20407
Follow-up to 1f11224 #18950

Closes #22072
Totktonada added a commit to Totktonada/tarantool that referenced this pull request Oct 2, 2026
libcurl requires CMake 3.18 [1], and nghttp2 asks for 3.14 since
1.70.0 [2]. We build both as ExternalProjects and a fresh CMake is a
prerequisite to update these dependencies.

Modern Linux distros offer 3.18 or newer, but some EOL ones don't:
CentOS 7, Ubuntu 20.04 for example. PackPack backports repositories
offer CMake 3.18 for some of them, see [3].

3.5 -> 3.18 sets 43 policies to NEW (CMP0066..CMP0108). Only CMP0082
changes the generated files: install rules from `add_subdirectory()`
now run where the call is, not after all rules of the current scope.
It only reorders src/lib and src/box, which install nothing. CMP0068
is the only behaviour change we could meet, on macOS only:
`CMAKE_SKIP_RPATH` stops suppressing `install_name` for our dynamic
libraries, which are not installed and used only for testing.

Shifting the minimum CMake version allows to eliminate a few
workarounds created for older versions. I plan to remove them in a
separate series.

[1]: curl/curl#20407
[2]: https://github.com/nghttp2/nghttp2/blob/v1.70.0/CMakeLists.txt
[3]: https://github.com/orgs/packpack/discussions/159

Drafted by an LLM, conducted and corrected by the commit author.

Fixes tarantool#13306

NO_CHANGELOG=build
NO_DOC=build
NO_TEST=build
Totktonada added a commit to tarantool/tarantool that referenced this pull request Oct 5, 2026
libcurl requires CMake 3.18 [1], and nghttp2 asks for 3.14 since
1.70.0 [2]. We build both as ExternalProjects and a fresh CMake is a
prerequisite to update these dependencies.

Modern Linux distros offer 3.18 or newer, but some EOL ones don't:
CentOS 7, Ubuntu 20.04 for example. PackPack backports repositories
offer CMake 3.18 for some of them, see [3].

3.5 -> 3.18 sets 43 policies to NEW (CMP0066..CMP0108). Only CMP0082
changes the generated files: install rules from `add_subdirectory()`
now run where the call is, not after all rules of the current scope.
It only reorders src/lib and src/box, which install nothing. CMP0068
is the only behaviour change we could meet, on macOS only:
`CMAKE_SKIP_RPATH` stops suppressing `install_name` for our dynamic
libraries, which are not installed and used only for testing.

Shifting the minimum CMake version allows to eliminate a few
workarounds created for older versions. I plan to remove them in a
separate series.

[1]: curl/curl#20407
[2]: https://github.com/nghttp2/nghttp2/blob/v1.70.0/CMakeLists.txt
[3]: https://github.com/orgs/packpack/discussions/159

Drafted by an LLM, conducted and corrected by the commit author.

Fixes #13306

NO_CHANGELOG=build
NO_DOC=build
NO_TEST=build
Totktonada added a commit to tarantool/tarantool that referenced this pull request Oct 5, 2026
libcurl requires CMake 3.18 [1], and nghttp2 asks for 3.14 since
1.70.0 [2]. We build both as ExternalProjects and a fresh CMake is a
prerequisite to update these dependencies.

Modern Linux distros offer 3.18 or newer, but some EOL ones don't:
CentOS 7, Ubuntu 20.04 for example. PackPack backports repositories
offer CMake 3.18 for some of them, see [3].

3.5 -> 3.18 sets 43 policies to NEW (CMP0066..CMP0108). Only CMP0082
changes the generated files: install rules from `add_subdirectory()`
now run where the call is, not after all rules of the current scope.
It only reorders src/lib and src/box, which install nothing. CMP0068
is the only behaviour change we could meet, on macOS only:
`CMAKE_SKIP_RPATH` stops suppressing `install_name` for our dynamic
libraries, which are not installed and used only for testing.

Shifting the minimum CMake version allows to eliminate a few
workarounds created for older versions. I plan to remove them in a
separate series.

[1]: curl/curl#20407
[2]: https://github.com/nghttp2/nghttp2/blob/v1.70.0/CMakeLists.txt
[3]: https://github.com/orgs/packpack/discussions/159

Drafted by an LLM, conducted and corrected by the commit author.

Fixes #13306

NO_CHANGELOG=build
NO_DOC=build
NO_TEST=build

(cherry picked from commit 30c5812)
Totktonada added a commit to tarantool/tarantool that referenced this pull request Oct 5, 2026
libcurl requires CMake 3.18 [1], and nghttp2 asks for 3.14 since
1.70.0 [2]. We build both as ExternalProjects and a fresh CMake is a
prerequisite to update these dependencies.

Modern Linux distros offer 3.18 or newer, but some EOL ones don't:
CentOS 7, Ubuntu 20.04 for example. PackPack backports repositories
offer CMake 3.18 for some of them, see [3].

3.5 -> 3.18 sets 43 policies to NEW (CMP0066..CMP0108). Only CMP0082
changes the generated files: install rules from `add_subdirectory()`
now run where the call is, not after all rules of the current scope.
It only reorders src/lib and src/box, which install nothing. CMP0068
is the only behaviour change we could meet, on macOS only:
`CMAKE_SKIP_RPATH` stops suppressing `install_name` for our dynamic
libraries, which are not installed and used only for testing.

Shifting the minimum CMake version allows to eliminate a few
workarounds created for older versions. I plan to remove them in a
separate series.

[1]: curl/curl#20407
[2]: https://github.com/nghttp2/nghttp2/blob/v1.70.0/CMakeLists.txt
[3]: https://github.com/orgs/packpack/discussions/159

Drafted by an LLM, conducted and corrected by the commit author.

Fixes #13306

NO_CHANGELOG=build
NO_DOC=build
NO_TEST=build

(cherry picked from commit 30c5812)
Totktonada added a commit to tarantool/tarantool that referenced this pull request Oct 5, 2026
libcurl requires CMake 3.18 [1], and nghttp2 asks for 3.14 since
1.70.0 [2]. We build both as ExternalProjects and a fresh CMake is a
prerequisite to update these dependencies.

Modern Linux distros offer 3.18 or newer, but some EOL ones don't:
CentOS 7, Ubuntu 20.04 for example. PackPack backports repositories
offer CMake 3.18 for some of them, see [3].

3.5 -> 3.18 sets 43 policies to NEW (CMP0066..CMP0108). Only CMP0082
changes the generated files: install rules from `add_subdirectory()`
now run where the call is, not after all rules of the current scope.
It only reorders src/lib and src/box, which install nothing. CMP0068
is the only behaviour change we could meet, on macOS only:
`CMAKE_SKIP_RPATH` stops suppressing `install_name` for our dynamic
libraries, which are not installed and used only for testing.

Shifting the minimum CMake version allows to eliminate a few
workarounds created for older versions. I plan to remove them in a
separate series.

[1]: curl/curl#20407
[2]: https://github.com/nghttp2/nghttp2/blob/v1.70.0/CMakeLists.txt
[3]: https://github.com/orgs/packpack/discussions/159

Drafted by an LLM, conducted and corrected by the commit author.

Fixes #13306

NO_CHANGELOG=build
NO_DOC=build
NO_TEST=build

(cherry picked from commit 30c5812)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration cmake cmdline tool feature-window A merge of this requires an open feature window tests

Development

Successfully merging this pull request may close these issues.

1 participant