Skip to content

Conversation

dbarker
Copy link
Member

@dbarker dbarker commented Aug 22, 2025

The cmake project macro takes VERSION and LANGUAGE args which are not currently being set in otel-cpp CMakeLists.txt.

CMake uses the VERSION arg to set internal variables (See https://cmake.org/cmake/help/v3.31/command/project.html#options) which are used by CMake. One example is for providing more info to the user when they call find_package(opentelemetry-cpp CONFIG).

Previous cmake message when calling find_package(opentelemetry-cpp CONFIG)

-- Found opentelemetry-cpp: /usr/local/include  

New cmake message when calling find_package(opentelemetry-cpp CONFIG)

-- Found opentelemetry-cpp: /usr/local/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake (found version "1.22.0") 

Changes

  • Move reading the api version header and setting the OPENTELEMETRY_VERSION and OPENTELEMETRY_ABI_VERSION_NO variables to cmake/version.cmake
  • Set the VERSION and LANGUAGE args in project(opentelemetry-cpp ...)
  • Set the OPENTELEMETRY_VERSION and OPENTELEMETRY_ABI_VERSION_NO as cached variables so users building otel-cpp in-tree with their project can know what version and abi number has been built.
  • Add checks in the FetchContent CI test for the cached variables.

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

…ndard config mode to find the project in the config.cmake file. Set cached variables for the version and abi number for in-tree builds with fetch content. Test the cached varaibles are set properly in ci
Copy link

netlify bot commented Aug 22, 2025

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

Name Link
🔨 Latest commit fe8ce0c
🔍 Latest deploy log https://app.netlify.com/projects/opentelemetry-cpp-api-docs/deploys/68a8fbd466df7c000868a51e

Copy link

codecov bot commented Aug 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.03%. Comparing base (dfa7118) to head (e249482).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3605   +/-   ##
=======================================
  Coverage   90.03%   90.03%           
=======================================
  Files         220      220           
  Lines        7069     7069           
=======================================
  Hits         6364     6364           
  Misses        705      705           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker dbarker marked this pull request as ready for review August 23, 2025 00:27
@dbarker dbarker requested a review from a team as a code owner August 23, 2025 00:27
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.

Thanks for the fix.

See comments, with some simplifications.

…explicitly. Add support to set a version suffix string
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, thanks for the fix.

@marcalff marcalff merged commit 6d7b8ad into open-telemetry:main Aug 27, 2025
66 checks passed
@dbarker dbarker deleted the cmake_set_project_version branch August 28, 2025 00:12
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.

4 participants