diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c25bbafbe..0f63d9a30b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: runs-on: ubuntu-24.04 env: CXX_STANDARD: '17' - CMAKE_VERSION: '3.14.0' + CMAKE_VERSION: '3.16.0' BUILD_TYPE: 'Debug' steps: - name: Harden the runner (Audit all outbound calls) diff --git a/.github/workflows/cmake_install.yml b/.github/workflows/cmake_install.yml index de8448d29b..866cac3bc2 100644 --- a/.github/workflows/cmake_install.yml +++ b/.github/workflows/cmake_install.yml @@ -153,7 +153,7 @@ jobs: env: INSTALL_TEST_DIR: '/home/runner/install_test' # Set to the current minimum version of cmake - CMAKE_VERSION: '3.14.0' + CMAKE_VERSION: '3.16.0' # cxx14 is the default for Ubuntu 22.04 CXX_STANDARD: '14' BUILD_TYPE: 'Debug' diff --git a/CHANGELOG.md b/CHANGELOG.md index bbcc8d708d..416ee21a81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,11 @@ Increment the: * [SDK] View should not have a unit [#3552](https://github.com/open-telemetry/opentelemetry-cpp/pull/3552) +Important changes: + +* [CMAKE] Upgrade CMake minimum version to 3.16 + [#3599](https://github.com/open-telemetry/opentelemetry-cpp/pull/3599) + Breaking changes: * [SDK] View should not have a unit diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a6f9cf99a..9b9838f27c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,23 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) - -# See https://cmake.org/cmake/help/latest/policy/CMP0074.html required by -# certain version of zlib which CURL depends on. -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12") - cmake_policy(SET CMP0074 NEW) -endif() - -# Allow to use normal variable for option() -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13") - cmake_policy(SET CMP0077 NEW) -endif() - -# Prefer CMAKE_MSVC_RUNTIME_LIBRARY if possible -if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) -endif() +cmake_minimum_required(VERSION 3.16) if(POLICY CMP0092) # https://cmake.org/cmake/help/latest/policy/CMP0092.html#policy:CMP0092 Make @@ -25,7 +9,7 @@ if(POLICY CMP0092) cmake_policy(SET CMP0092 OLD) endif() -# MSVC RTTI flag /GR should not be not added to CMAKE_CXX_FLAGS by default. @see +# MSVC RTTI flag /GR should not be added to CMAKE_CXX_FLAGS by default. @see # https://cmake.org/cmake/help/latest/policy/CMP0117.html if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20.0") cmake_policy(SET CMP0117 NEW) @@ -36,11 +20,6 @@ project(opentelemetry-cpp) # Mark variables as used so cmake doesn't complain about them mark_as_advanced(CMAKE_TOOLCHAIN_FILE) -# Don't use customized cmake modules if vcpkg is used to resolve dependence. -if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) - list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") -endif() - # Set the third-party release git tags. if(EXISTS "${opentelemetry-cpp_SOURCE_DIR}/third_party_release") file(STRINGS "${opentelemetry-cpp_SOURCE_DIR}/third_party_release" diff --git a/INSTALL.md b/INSTALL.md index 296a61c44b..94f558c4f1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -23,8 +23,7 @@ You can link OpenTelemetry C++ SDK with libraries provided in repository. To install Git, consult the [Set up Git](https://help.github.com/articles/set-up-git/) guide on GitHub. - [CMake](https://cmake.org/) for building opentelemetry-cpp API, SDK with their - unittests. The minimum CMake version is 3.14. - CMake 3.15+ is recommended on Windows due to known CI test failures with 3.14. + unittests. The minimum CMake version is 3.16. To install CMake, consult the [Installing CMake](https://cmake.org/install/) guide. - [GoogleTest](https://github.com/google/googletest) framework to build and run diff --git a/install/cmake/CMakeLists.txt b/install/cmake/CMakeLists.txt index e83964375b..d6785a46b5 100644 --- a/install/cmake/CMakeLists.txt +++ b/install/cmake/CMakeLists.txt @@ -22,7 +22,7 @@ # CMAKE_CXX_STANDARD: The C++ standard to use for all third-party packages. # Defaults to 14 if not set. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-thirdparty-install LANGUAGES CXX) # Added in CMake 3.16. ExternalProject_Add() with GIT_SUBMODULES "" initializes diff --git a/install/test/cmake/CMakeLists.txt b/install/test/cmake/CMakeLists.txt index b12720e141..dfe569bf8f 100644 --- a/install/test/cmake/CMakeLists.txt +++ b/install/test/cmake/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-component-install-tests LANGUAGES CXX) if(NOT INSTALL_TEST_CMAKE_OPTIONS) diff --git a/install/test/cmake/component_tests/api/CMakeLists.txt b/install/test/cmake/component_tests/api/CMakeLists.txt index 271255f587..4255be5519 100644 --- a/install/test/cmake/component_tests/api/CMakeLists.txt +++ b/install/test/cmake/component_tests/api/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-api-install-test LANGUAGES CXX) diff --git a/install/test/cmake/component_tests/exporters_elasticsearch/CMakeLists.txt b/install/test/cmake/component_tests/exporters_elasticsearch/CMakeLists.txt index 9b2d7ef1ab..1c68bd46d3 100644 --- a/install/test/cmake/component_tests/exporters_elasticsearch/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_elasticsearch/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters-elasticsearch-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_elasticsearch) diff --git a/install/test/cmake/component_tests/exporters_etw/CMakeLists.txt b/install/test/cmake/component_tests/exporters_etw/CMakeLists.txt index b2dcb302b0..460d0f0e7d 100644 --- a/install/test/cmake/component_tests/exporters_etw/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_etw/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters_etw-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_etw) diff --git a/install/test/cmake/component_tests/exporters_in_memory/CMakeLists.txt b/install/test/cmake/component_tests/exporters_in_memory/CMakeLists.txt index ca3ab3e32e..e6308743ad 100644 --- a/install/test/cmake/component_tests/exporters_in_memory/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_in_memory/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters-in-memory-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_in_memory) diff --git a/install/test/cmake/component_tests/exporters_ostream/CMakeLists.txt b/install/test/cmake/component_tests/exporters_ostream/CMakeLists.txt index 2028b4b92a..bb510acc3b 100644 --- a/install/test/cmake/component_tests/exporters_ostream/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_ostream/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters-ostream-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_ostream) diff --git a/install/test/cmake/component_tests/exporters_otlp_common/CMakeLists.txt b/install/test/cmake/component_tests/exporters_otlp_common/CMakeLists.txt index a9d9a0c275..98404f5cdf 100644 --- a/install/test/cmake/component_tests/exporters_otlp_common/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_otlp_common/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters-otlp-common-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_otlp_common) diff --git a/install/test/cmake/component_tests/exporters_otlp_file/CMakeLists.txt b/install/test/cmake/component_tests/exporters_otlp_file/CMakeLists.txt index 11d79dfd6d..5886f51a2f 100644 --- a/install/test/cmake/component_tests/exporters_otlp_file/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_otlp_file/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters-otlp-file-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_otlp_file) diff --git a/install/test/cmake/component_tests/exporters_otlp_grpc/CMakeLists.txt b/install/test/cmake/component_tests/exporters_otlp_grpc/CMakeLists.txt index 6e9b4b6b91..2494c84342 100644 --- a/install/test/cmake/component_tests/exporters_otlp_grpc/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_otlp_grpc/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters-otlp-grpc-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_otlp_grpc) diff --git a/install/test/cmake/component_tests/exporters_otlp_http/CMakeLists.txt b/install/test/cmake/component_tests/exporters_otlp_http/CMakeLists.txt index 09b4f433de..5404611f4c 100644 --- a/install/test/cmake/component_tests/exporters_otlp_http/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_otlp_http/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters-otlp-http-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_otlp_http) diff --git a/install/test/cmake/component_tests/exporters_prometheus/CMakeLists.txt b/install/test/cmake/component_tests/exporters_prometheus/CMakeLists.txt index 526a01626d..2192b6ff46 100644 --- a/install/test/cmake/component_tests/exporters_prometheus/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_prometheus/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters-prometheus-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_prometheus) diff --git a/install/test/cmake/component_tests/exporters_zipkin/CMakeLists.txt b/install/test/cmake/component_tests/exporters_zipkin/CMakeLists.txt index 378794bceb..13f4a5e8dd 100644 --- a/install/test/cmake/component_tests/exporters_zipkin/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_zipkin/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-exporters-zipkin-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_zipkin) diff --git a/install/test/cmake/component_tests/ext_common/CMakeLists.txt b/install/test/cmake/component_tests/ext_common/CMakeLists.txt index c80058318b..cee59f0b5c 100644 --- a/install/test/cmake/component_tests/ext_common/CMakeLists.txt +++ b/install/test/cmake/component_tests/ext_common/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-ext_common-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS ext_common) diff --git a/install/test/cmake/component_tests/ext_dll/CMakeLists.txt b/install/test/cmake/component_tests/ext_dll/CMakeLists.txt index d02fdf9455..46940db1ad 100644 --- a/install/test/cmake/component_tests/ext_dll/CMakeLists.txt +++ b/install/test/cmake/component_tests/ext_dll/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-ext_dll-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS ext_dll exporters_ostream) diff --git a/install/test/cmake/component_tests/ext_http_curl/CMakeLists.txt b/install/test/cmake/component_tests/ext_http_curl/CMakeLists.txt index f9adda65cf..2c7cbe7f8c 100644 --- a/install/test/cmake/component_tests/ext_http_curl/CMakeLists.txt +++ b/install/test/cmake/component_tests/ext_http_curl/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-ext_http_curl-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS ext_http_curl) diff --git a/install/test/cmake/component_tests/sdk/CMakeLists.txt b/install/test/cmake/component_tests/sdk/CMakeLists.txt index 1dd110231d..900ece1a32 100644 --- a/install/test/cmake/component_tests/sdk/CMakeLists.txt +++ b/install/test/cmake/component_tests/sdk/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-sdk-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS sdk) diff --git a/install/test/cmake/component_tests/shims_opentracing/CMakeLists.txt b/install/test/cmake/component_tests/shims_opentracing/CMakeLists.txt index 2b45e2528e..c2e73e15e0 100644 --- a/install/test/cmake/component_tests/shims_opentracing/CMakeLists.txt +++ b/install/test/cmake/component_tests/shims_opentracing/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-shims_opentracing-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS shims_opentracing) diff --git a/install/test/cmake/examples_test/CMakeLists.txt b/install/test/cmake/examples_test/CMakeLists.txt index 3b94e295a6..c1489ea71f 100644 --- a/install/test/cmake/examples_test/CMakeLists.txt +++ b/install/test/cmake/examples_test/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-examples-test LANGUAGES CXX) diff --git a/install/test/cmake/fetch_content_test/CMakeLists.txt b/install/test/cmake/fetch_content_test/CMakeLists.txt index 6b5fd0e94b..c03e8b245a 100644 --- a/install/test/cmake/fetch_content_test/CMakeLists.txt +++ b/install/test/cmake/fetch_content_test/CMakeLists.txt @@ -4,7 +4,7 @@ # This test uses CMake's FetchContent module to build opentelemetry-cpp from src # and make its targets available within an external project. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-fetch-content-test LANGUAGES CXX) diff --git a/install/test/cmake/package_test/CMakeLists.txt b/install/test/cmake/package_test/CMakeLists.txt index 63f5bf4248..a6c7832087 100644 --- a/install/test/cmake/package_test/CMakeLists.txt +++ b/install/test/cmake/package_test/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-full-package-install-test LANGUAGES CXX) diff --git a/install/test/cmake/usage_tests/missing_components/CMakeLists.txt b/install/test/cmake/usage_tests/missing_components/CMakeLists.txt index adbf5fd8fd..0f123511ad 100644 --- a/install/test/cmake/usage_tests/missing_components/CMakeLists.txt +++ b/install/test/cmake/usage_tests/missing_components/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-unsorted-components-install-test LANGUAGES CXX) diff --git a/install/test/cmake/usage_tests/no_components/CMakeLists.txt b/install/test/cmake/usage_tests/no_components/CMakeLists.txt index 17fec851d7..7e4f092b9f 100644 --- a/install/test/cmake/usage_tests/no_components/CMakeLists.txt +++ b/install/test/cmake/usage_tests/no_components/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-unsorted-components-install-test LANGUAGES CXX) diff --git a/install/test/cmake/usage_tests/unsorted_components/CMakeLists.txt b/install/test/cmake/usage_tests/unsorted_components/CMakeLists.txt index 3fdd175a15..7eb7465043 100644 --- a/install/test/cmake/usage_tests/unsorted_components/CMakeLists.txt +++ b/install/test/cmake/usage_tests/unsorted_components/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-unsorted-components-install-test LANGUAGES CXX) diff --git a/install/test/cmake/usage_tests/unsupported_components/CMakeLists.txt b/install/test/cmake/usage_tests/unsupported_components/CMakeLists.txt index 43ab06c0b6..f799f4850b 100644 --- a/install/test/cmake/usage_tests/unsupported_components/CMakeLists.txt +++ b/install/test/cmake/usage_tests/unsupported_components/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(opentelemetry-cpp-unsupported-components-install-test LANGUAGES CXX)