-
Notifications
You must be signed in to change notification settings - Fork 576
[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
Changes from 8 commits
08b9b3a
e9cabbb
0d7f90b
8a85826
80db032
6493ea3
ee19538
7ca29e7
9bb6fdb
061d39c
e50e20e
b4da661
97a1e75
7d29c69
9550ae2
c0ff987
848428a
f3944bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,8 @@ on: | |
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| windows_2022_vcpkg: | ||
| name: Windows 2022 vcpkg cxx17 (static libs - dll) | ||
| windows_2022_vcpkg_submodule: | ||
| name: Windows 2022 vcpkg submodule versions cxx17 (static libs - dll) | ||
| runs-on: windows-2022 | ||
| env: | ||
| CXX_STANDARD: '17' | ||
|
|
@@ -26,10 +26,11 @@ jobs: | |
| - name: Run DLL Tests | ||
| run: ./ci/do_ci.ps1 cmake.dll.install.test | ||
|
|
||
| windows_2019_vcpkg: | ||
| name: Windows 2019 vcpkg cxx14 (static libs) | ||
| windows_2019_vcpkg_submodule_min_cmake: | ||
| name: Windows 2019 vcpkg submodule versions minimum cmake cxx14 (static libs) | ||
| runs-on: windows-2019 | ||
| env: | ||
| CMAKE_VERSION: '3.15.0' | ||
| CXX_STANDARD: '14' | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
@@ -47,6 +48,7 @@ jobs: | |
| runs-on: ubuntu-24.04 | ||
| env: | ||
| INSTALL_TEST_DIR: '/home/runner/install_test' | ||
| CMAKE_VERSION: '3.28.3' | ||
|
lalitb marked this conversation as resolved.
|
||
| CXX_STANDARD: '17' | ||
| BUILD_TYPE: 'Debug' | ||
| steps: | ||
|
|
@@ -71,12 +73,16 @@ jobs: | |
| BUILD_SHARED_LIBS: 'ON' | ||
| run: ./ci/do_ci.sh cmake.install.test | ||
|
|
||
| ubuntu_2404_script_build_grpc_1_71_0: | ||
| name: Ubuntu 24.04 script grpc 1.71.0 cxx17 (static libs) | ||
| ubuntu_2404_latest: | ||
| name: Ubuntu 24.04 latest versions cxx20 (static libs) | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| INSTALL_TEST_DIR: '/home/runner/install_test' | ||
| CXX_STANDARD: '20' | ||
| GOOGLETEST_VERSION: '1.16.0' | ||
| ABSEIL_CPP_VERSION: '20240722.1' | ||
| PROTOBUF_VERSION: '29.0' | ||
| GRPC_VERSION: 'v1.71.0' | ||
|
lalitb marked this conversation as resolved.
|
||
| BUILD_TYPE: 'Debug' | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
@@ -88,10 +94,6 @@ jobs: | |
| sudo -E ./ci/setup_cmake.sh | ||
| sudo -E ./ci/setup_googletest.sh | ||
| - name: Build abseil, protobuf, and grpc with ci scripts | ||
| env: | ||
| ABSEIL_CPP_VERSION: '20240722.1' | ||
| PROTOBUF_VERSION: '29.0' | ||
| GRPC_VERSION: 'v1.71.0' | ||
| run: | | ||
| sudo -E ./ci/install_abseil.sh | ||
| sudo -E ./ci/install_protobuf.sh | ||
|
|
@@ -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: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: CMAKE_VERSION specified for most jobs, except a this and
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The I'm not apposed to setting CMAKE_VERSION in every job explicitly if others feel strongly.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
-- ---------------------------------------------
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 👍🏻
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
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). |
||
| name: Ubuntu 22.04 stable versions cxx17 (static libs - shared libs) | ||
| runs-on: ubuntu-22.04 | ||
| env: | ||
| INSTALL_TEST_DIR: '/home/runner/install_test' | ||
| CMAKE_VERSION: '3.22.0' | ||
| CXX_STANDARD: '17' | ||
| GOOGLETEST_VERSION: '1.14.0' | ||
| ABSEIL_CPP_VERSION: '20230125.3' | ||
| PROTOBUF_VERSION: '23.3' | ||
| GRPC_VERSION: 'v1.55.0' | ||
| BUILD_TYPE: 'Debug' | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
@@ -118,10 +125,6 @@ jobs: | |
| sudo -E ./ci/setup_cmake.sh | ||
| sudo -E ./ci/setup_googletest.sh | ||
| - name: Build abseil, protobuf, and grpc with ci scripts | ||
| env: | ||
| ABSEIL_CPP_VERSION: '20230125.3' | ||
| PROTOBUF_VERSION: '23.3' | ||
| GRPC_VERSION: 'v1.55.0' | ||
| run: | | ||
| sudo -E ./ci/install_abseil.sh | ||
| sudo -E ./ci/install_protobuf.sh | ||
|
|
@@ -135,12 +138,17 @@ jobs: | |
| BUILD_SHARED_LIBS: 'ON' | ||
| run: ./ci/do_ci.sh cmake.install.test | ||
|
|
||
| ubuntu_2204_script_build_grpc_1_49_2: | ||
| name: Ubuntu 22.04 script grpc 1.49.2 cxx14 (static libs - shared libs) | ||
| ubuntu_2204_minimum: | ||
| name: Ubuntu 22.04 minimum versions cxx14 (static libs - shared libs) | ||
| runs-on: ubuntu-22.04 | ||
| env: | ||
| INSTALL_TEST_DIR: '/home/runner/install_test' | ||
| CMAKE_VERSION: '3.14.0' | ||
|
dbarker marked this conversation as resolved.
|
||
| GOOGLETEST_VERSION: '1.11.0' | ||
| CXX_STANDARD: '14' | ||
| ABSEIL_CPP_VERSION: '20220623.2' | ||
| PROTOBUF_VERSION: '21.12' | ||
| GRPC_VERSION: 'v1.49.2' | ||
| BUILD_TYPE: 'Debug' | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
@@ -152,10 +160,6 @@ jobs: | |
| sudo -E ./ci/setup_cmake.sh | ||
| sudo -E ./ci/setup_googletest.sh | ||
| - name: Build abseil, protobuf, and grpc with ci scripts | ||
| env: | ||
| ABSEIL_CPP_VERSION: '20220623.2' | ||
| PROTOBUF_VERSION: '21.12' | ||
| GRPC_VERSION: 'v1.49.2' | ||
| run: | | ||
| sudo -E ./ci/install_abseil.sh | ||
| sudo -E ./ci/install_protobuf.sh | ||
|
|
@@ -170,10 +174,11 @@ jobs: | |
| run: ./ci/do_ci.sh cmake.install.test | ||
|
|
||
| ubuntu_2404_conan_stable: | ||
| name: Ubuntu 24.04 conan stable cxx17 (static libs - shared libs - opentracing shim) | ||
| name: Ubuntu 24.04 conan stable versions cxx17 (static libs - shared libs - opentracing shim) | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| INSTALL_TEST_DIR: '/home/runner/install_test' | ||
| CMAKE_VERSION: '3.28.3' | ||
| CXX_STANDARD: '17' | ||
| CMAKE_TOOLCHAIN_FILE: /home/runner/conan/build/Debug/generators/conan_toolchain.cmake | ||
| BUILD_TYPE: 'Debug' | ||
|
|
@@ -189,7 +194,7 @@ jobs: | |
| - name: Install or build all dependencies with Conan | ||
| run: | | ||
| sudo -E ./ci/setup_cmake.sh | ||
| conan install install/conan/conanfile_stable.txt --build=missing -of /home/runner/conan -s build_type=Debug | ||
| conan install install/conan/conanfile_stable.txt --build=missing -of /home/runner/conan -s build_type=${BUILD_TYPE} -s compiler.cppstd=${CXX_STANDARD} | ||
| - name: Run Tests (static libs) | ||
| env: | ||
| BUILD_SHARED_LIBS: 'OFF' | ||
|
|
@@ -206,7 +211,7 @@ jobs: | |
| run: ./ci/do_ci.sh cmake.opentracing_shim.install.test | ||
|
|
||
| ubuntu_2404_conan_latest: | ||
| name: Ubuntu 24.04 conan latest cxx17 (static libs) | ||
| name: Ubuntu 24.04 conan latest versions cxx17 (static libs) | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| INSTALL_TEST_DIR: '/home/runner/install_test' | ||
|
|
@@ -225,7 +230,7 @@ jobs: | |
| - name: Install or build all dependencies with Conan | ||
| run: | | ||
| sudo -E ./ci/setup_cmake.sh | ||
| conan install install/conan/conanfile_latest.txt --build=missing -of /home/runner/conan -s build_type=Debug | ||
| conan install install/conan/conanfile_latest.txt --build=missing -of /home/runner/conan -s build_type=${BUILD_TYPE} -s compiler.cppstd=${CXX_STANDARD} | ||
| - name: Run Tests (static libs) | ||
| env: | ||
| BUILD_SHARED_LIBS: 'OFF' | ||
|
|
@@ -236,11 +241,12 @@ jobs: | |
| ./ci/verify_packages.sh | ||
|
|
||
| macos_14_conan_stable: | ||
| name: macOS 14 conan stable cxx17 (static libs) | ||
| name: macOS 14 conan stable versions cxx17 (static libs) | ||
| runs-on: macos-14 | ||
| env: | ||
| INSTALL_TEST_DIR: '/Users/runner/install_test' | ||
| CXX_STANDARD: '17' | ||
| CMAKE_VERSION: '3.28.3' | ||
| CMAKE_TOOLCHAIN_FILE: '/Users/runner/conan/build/Debug/generators/conan_toolchain.cmake' | ||
| BUILD_TYPE: 'Debug' | ||
| steps: | ||
|
|
@@ -250,17 +256,17 @@ jobs: | |
| - name: Install Conan and tools | ||
| run: | | ||
| brew install conan autoconf automake libtool coreutils | ||
| sudo -E ./ci/setup_cmake_macos.sh | ||
| ./ci/setup_cmake_macos.sh | ||
| conan profile detect --force | ||
| - name: Install or build all dependencies with Conan | ||
| run: conan install install/conan/conanfile_stable.txt --build=missing -of /Users/runner/conan -s build_type=Debug | ||
| run: conan install install/conan/conanfile_stable.txt --build=missing -of /Users/runner/conan -s build_type=${BUILD_TYPE} -s compiler.cppstd=${CXX_STANDARD} | ||
| - name: Run Tests (static libs) | ||
| env: | ||
| BUILD_SHARED_LIBS: 'OFF' | ||
| run: ./ci/do_ci.sh cmake.install.test | ||
|
|
||
| macos_14_brew_packages: | ||
| name: macOS 14 brew packages cxx17 (static libs) | ||
| name: macOS 14 brew latest versions cxx17 (static libs) | ||
| runs-on: macos-14 | ||
| env: | ||
| CXX_STANDARD: '17' | ||
|
|
@@ -271,7 +277,7 @@ jobs: | |
| submodules: 'recursive' | ||
| - name: Install Dependencies with Homebrew | ||
| run: | | ||
| sudo -E ./ci/setup_cmake_macos.sh | ||
| ./ci/setup_cmake_macos.sh | ||
| brew install coreutils | ||
| brew install googletest | ||
| brew install google-benchmark | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -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) | ||||||
|
dbarker marked this conversation as resolved.
|
||||||
|
|
||||||
| # See https://cmake.org/cmake/help/latest/policy/CMP0074.html required by | ||||||
| # certain version of zlib which CURL depends on. | ||||||
|
|
@@ -36,8 +36,9 @@ project(opentelemetry-cpp) | |||||
| # Mark variables as used so cmake doesn't complain about them | ||||||
| mark_as_advanced(CMAKE_TOOLCHAIN_FILE) | ||||||
|
|
||||||
| # Prefer cmake CONFIG to auto resolve dependencies. This is important to | ||||||
| # properly find protobuf versions 3.22.0 and above | ||||||
| # Note: CMAKE_FIND_PACKAGE_PREFER_CONFIG requires cmake 3.15. Prefer cmake | ||||||
|
lalitb marked this conversation as resolved.
|
||||||
| # CONFIG search mode to find dependencies. This is important to properly find | ||||||
| # protobuf versions 3.22.0 and above due to the abseil-cpp dependency. | ||||||
| set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE) | ||||||
|
owent marked this conversation as resolved.
|
||||||
|
|
||||||
| # Don't use customized cmake modules if vcpkg is used to resolve dependence. | ||||||
|
|
@@ -420,15 +421,31 @@ if(WITH_OTLP_GRPC | |||||
| OR WITH_OTLP_HTTP | ||||||
| OR WITH_OTLP_FILE) | ||||||
|
|
||||||
| find_package(Protobuf) | ||||||
| # Protobuf 3.22 or upper require abseil-cpp, we can find it in | ||||||
| # opentelemetry-cpp-config.cmake | ||||||
| # Including the CMakeFindDependencyMacro resolves an error from | ||||||
| # gRPCConfig.cmake on some grpc versions. See | ||||||
| # https://github.com/grpc/grpc/pull/33361 for more details. | ||||||
| include(CMakeFindDependencyMacro) | ||||||
|
owent marked this conversation as resolved.
|
||||||
|
|
||||||
| # Protobuf 3.22+ and depends on abseil-cpp and must be found using the CONFIG | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||
| # search mode. The following attempts to find Protobuf using the CONFIG mode | ||||||
| # first, and if not found, falls back to the MODULE mode. See | ||||||
| # https://gitlab.kitware.com/cmake/cmake/-/issues/24321 for more details. | ||||||
| find_package(Protobuf CONFIG) | ||||||
|
owent marked this conversation as resolved.
|
||||||
| if(NOT Protobuf_FOUND) | ||||||
| find_package(Protobuf MODULE) | ||||||
| if(Protobuf_FOUND AND Protobuf_VERSION VERSION_GE "3.22.0") | ||||||
| message( | ||||||
| WARNING | ||||||
| "Found Protobuf version ${Protobuf_VERSION} using MODULE mode. " | ||||||
| "Linking errors may occur. Protobuf 3.22+ depends on abseil-cpp " | ||||||
| "and should be found using the CONFIG mode.") | ||||||
| endif() | ||||||
| endif() | ||||||
|
|
||||||
| if(WITH_OTLP_GRPC) | ||||||
| find_package(gRPC CONFIG) | ||||||
| endif() | ||||||
| if((NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND) OR (WITH_OTLP_GRPC | ||||||
| AND NOT gRPC_FOUND)) | ||||||
| if((NOT Protobuf_FOUND) OR (WITH_OTLP_GRPC AND NOT gRPC_FOUND)) | ||||||
| if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) | ||||||
| install_windows_deps() | ||||||
| endif() | ||||||
|
|
@@ -440,8 +457,8 @@ if(WITH_OTLP_GRPC | |||||
| include(${CMAKE_TOOLCHAIN_FILE}) | ||||||
| endif() | ||||||
|
|
||||||
| if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND) | ||||||
| find_package(Protobuf REQUIRED) | ||||||
| if(NOT Protobuf_FOUND) | ||||||
| find_package(Protobuf CONFIG REQUIRED) | ||||||
| endif() | ||||||
| if(NOT gRPC_FOUND AND WITH_OTLP_GRPC) | ||||||
| find_package(gRPC CONFIG) | ||||||
|
|
@@ -502,6 +519,11 @@ endif() | |||||
| if((NOT WITH_API_ONLY) AND WITH_HTTP_CLIENT_CURL) | ||||||
| # No specific version required. | ||||||
| find_package(CURL REQUIRED) | ||||||
| # Set the CURL_VERSION from the legacy CURL_VERSION_STRING Required for CMake | ||||||
| # versions below 4.0 | ||||||
| if(NOT DEFINED CURL_VERSION AND DEFINED CURL_VERSION_STRING) | ||||||
| set(CURL_VERSION ${CURL_VERSION_STRING}) | ||||||
| endif() | ||||||
| endif() | ||||||
|
|
||||||
| # | ||||||
|
|
@@ -513,6 +535,11 @@ if((NOT WITH_API_ONLY) | |||||
| AND WITH_OTLP_HTTP_COMPRESSION) | ||||||
| # No specific version required. | ||||||
| find_package(ZLIB REQUIRED) | ||||||
| # Set the ZLIB_VERSION from the legacy ZLIB_VERSION_STRING Required for CMake | ||||||
| # versions below 3.26 | ||||||
| if(NOT DEFINED ZLIB_VERSION AND DEFINED ZLIB_VERSION_STRING) | ||||||
| set(ZLIB_VERSION ${ZLIB_VERSION_STRING}) | ||||||
| endif() | ||||||
| endif() | ||||||
|
|
||||||
| # | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.