-
Notifications
You must be signed in to change notification settings - Fork 483
[CMAKE] bump cmake minimum required version to 3.14 #3349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CMAKE] bump cmake minimum required version to 3.14 #3349
Conversation
…including the min version. update the conan stable file to test older versions of benchmark and prometheus-cpp
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3349 +/- ##
=======================================
Coverage 89.56% 89.56%
=======================================
Files 210 210
Lines 6502 6502
=======================================
Hits 5823 5823
Misses 679 679 🚀 New features to boost your workflow:
|
…ake 3.15. Set the windows job to cmake 3.15
@@ -1,7 +1,7 @@ | |||
# Copyright The OpenTelemetry Authors | |||
# SPDX-License-Identifier: Apache-2.0 | |||
|
|||
cmake_minimum_required(VERSION 3.10) | |||
cmake_minimum_required(VERSION 3.14) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rationale for bumping to 3.14
- prometheus-cpp 1.0.0 requires cmake 3.14
- googletest 1.14 requires cmake 3.13
- Marc's comment on the last version bump implies 3.14 is okay for his project - [CMake] Upgrade cmake_minimum_required to 3.10 #3166 (comment)
- Enables using the cmake FetchContent_MakeAvailable command which can help with Build googletest at buildtime, relying on CMake #3267
caveats
- The otlp file exporter tests fail on windows unless built with cmake 3.15 see ExportToFileSystemRotateIndexTest and ExportToFileSystemRotateByTimeTest failures
- The
CMAKE_FIND_PACKAGE_PREFER_CONFIG
option comes with 3.15 so changes in this file are required to properly find protobuf 3.22.0+ with cmake 3.14.
runs-on: windows-2019 | ||
env: | ||
CMAKE_VERSION: '3.15.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows tests only pass with cmake 3.15.0+ currently. This may be due to the addition of policy CMP0091 in cmake 3.15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Could we add this information as a comment in the file itself ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment
runs-on: ubuntu-22.04 | ||
env: | ||
INSTALL_TEST_DIR: '/home/runner/install_test' | ||
CMAKE_VERSION: '3.14.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests pass in Ubuntu 22.04 with cmake 3.14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, see minor comments.
CMakeLists.txt
Outdated
find_package(Protobuf) | ||
# Protobuf 3.22 or upper require abseil-cpp, we can find it in | ||
# opentelemetry-cpp-config.cmake | ||
# Note: remove once cmake 3.14 is no longer supported including the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Note: remove once cmake 3.14 is no longer supported including the | |
# Note: remove once cmake 3.14 is no longer supported. Including the |
install/test/cmake/component_tests/exporters_elasticsearch/CMakeLists.txt
Outdated
Show resolved
Hide resolved
…iables. Remove legacy PROTOBUF_FOUND.
runs-on: windows-2019 | ||
env: | ||
CMAKE_VERSION: '3.15.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Could we add this information as a comment in the file itself ?
@@ -101,12 +103,17 @@ jobs: | |||
BUILD_SHARED_LIBS: 'OFF' | |||
run: ./ci/do_ci.sh cmake.install.test | |||
|
|||
ubuntu_2204_script_build_grpc_1_55_0: | |||
name: Ubuntu 22.04 script grpc 1.55.0 cxx17 (static libs - shared libs) | |||
ubuntu_2204_stable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: CMAKE_VERSION specified for most jobs, except a this and macos_14_brew_packages
. Any particular reason for that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setup_cmake*
scripts default to cmake 3.31.6 now. The scripts in the main ci.yml workflow also use the default.
I'm not apposed to setting CMAKE_VERSION in every job explicitly if others feel strongly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cmake version can be found in the ci logs at two places:
Verifying installed versions...
cmake version: 3.31.6 detected
ctest version: 3.31.6 detected
cpack version: 3.31.6 detected
-- ---------------------------------------------
-- versions
-- ---------------------------------------------
-- CMake: 3.31.6
-- GTest: 1.16.0
-- benchmark: 1.9.2
-- Abseil: 20240722
-- Protobuf: 29.3.0
-- gRPC: 1.71.0
-- CURL: 8.6.0
-- ZLIB: 1.2.12
-- nlohmann-json: 3.11.3
-- prometheus-cpp: 1.3.0
-- ---------------------------------------------
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion on whether the version should be explicitly specified either, but if the version is only being specified on certain jobs due to some technical constraints (like CI fails if we the default cmake version is used), I do think it is worthwhile to document why the version is being explicitly mentioned on those jobs.
This would be helpful in the future if and when we re-visit this file to upgrade or modify the jobs.
I'm not an expert on CMake, so I'll defer the final decision to you though 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback. I've updated the cmake install test workflow to set the version explicitly for all jobs.
but if the version is only being specified on certain jobs due to some technical constraints (like CI fails if we the default cmake version is used), I do think it is worthwhile to document why the version is being explicitly mentioned on those jobs.
Great point. The only cases I'm aware of where ci fails based on the cmake version is windows with 3.14 (comment added to the CMake Install Test github workflow) and with cmake 4.0.0 (documented in #3334).
… error on protobuf version warning. Remove bzip2 as dependency for conan builds
…all test job. Add newline to the end of setup_cmake.ps1
…ommend cmake 3.15+ on windows.
…t failures with cmake 3.14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, thanks.
CMakeLists.txt
Outdated
# https://github.com/grpc/grpc/pull/33361 for more details. | ||
include(CMakeFindDependencyMacro) | ||
|
||
# Protobuf 3.22+ and depends on abseil-cpp and must be found using the CONFIG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Protobuf 3.22+ and depends on abseil-cpp and must be found using the CONFIG | |
# Protobuf 3.22+ depends on abseil-cpp and must be found using the CONFIG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what does it mean for "must be found using the CONFIG search mode"? Seems module mode is also tried.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is referencing the cmake find_package search modes. The module mode is also tried to ensure capability with protobuf packages that don't include the cmake config file (which enables the config search mode). For example the Ubuntu packages for libprotobuf must be found with the module search mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the comment to be clear this is the cmake find_package search mode.
@@ -8,7 +8,7 @@ abseil/20230125.3 | |||
protobuf/3.21.12 | |||
grpc/1.54.3 | |||
nlohmann_json/3.10.5 | |||
prometheus-cpp/1.3.0 | |||
prometheus-cpp/1.2.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is version downgraded here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is prometheus 1.2.4 support expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is version downgraded here?
The conan based install tests have a "latest" and "stable" conanfile in install/conan
. The conan file for "latest" includes prometheus-cpp/1.3.0. I downgraded prometheus-cpp version in the "stable" conan file to ensure the previous version was also tested.
Fixes #3348
Changes
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes