Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 18 commits into from
Apr 13, 2025

Conversation

dbarker
Copy link
Contributor

@dbarker dbarker commented Apr 6, 2025

Fixes #3348

Changes

  • updates setup_cmake* scripts to verify the cmake version installed
  • bumps the cmake min version to 3.14 and fixes issues found when testing with that version
  • updates the cmake install test github workflow to test specific cmake versions including the min version

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Copy link

netlify bot commented Apr 6, 2025

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit f3944bf
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/67f92d362bf4dd000879aa49

Copy link

codecov bot commented Apr 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.56%. Comparing base (4d52ab2) to head (f3944bf).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker dbarker changed the title [BUILD] bump cmake minimum required version to 3.14 [CMAKE] bump cmake minimum required version to 3.14 Apr 6, 2025
@dbarker dbarker marked this pull request as ready for review April 7, 2025 00:13
@dbarker dbarker requested a review from a team as a code owner April 7, 2025 00:13
@@ -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)
Copy link
Contributor Author

@dbarker dbarker Apr 7, 2025

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

caveats

runs-on: windows-2019
env:
CMAKE_VERSION: '3.15.0'
Copy link
Contributor Author

@dbarker dbarker Apr 7, 2025

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

Copy link
Contributor

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 ?

Copy link
Contributor Author

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'
Copy link
Contributor Author

@dbarker dbarker Apr 7, 2025

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

Copy link
Member

@marcalff marcalff left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Note: remove once cmake 3.14 is no longer supported including the
# Note: remove once cmake 3.14 is no longer supported. Including the

runs-on: windows-2019
env:
CMAKE_VERSION: '3.15.0'
Copy link
Contributor

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:
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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:

In the install step

Verifying installed versions...
cmake version: 3.31.6 detected
ctest version: 3.31.6 detected
cpack version: 3.31.6 detected

Run test step

-- ---------------------------------------------
-- 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
-- ---------------------------------------------

Copy link
Contributor

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 👍🏻

Copy link
Contributor Author

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).

@open-telemetry open-telemetry deleted a comment from TheMenisFactor Apr 7, 2025
Copy link
Member

@owent owent left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor Author

@dbarker dbarker Apr 11, 2025

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.

@lalitb lalitb merged commit 34375d7 into open-telemetry:main Apr 13, 2025
66 checks passed
@dbarker dbarker deleted the build_set_cmake_minimum_to_3_14 branch April 19, 2025 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bump cmake min version to 3.14
6 participants