diff --git a/.github/workflows/cmake_install.yml b/.github/workflows/cmake_install.yml index 0ace3a9185..ed4411398a 100644 --- a/.github/workflows/cmake_install.yml +++ b/.github/workflows/cmake_install.yml @@ -8,10 +8,13 @@ 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: + # Set to the latest version of cmake 3.x + CMAKE_VERSION: '3.31.6' + # cxx17 is the default for windows-2022 CXX_STANDARD: '17' steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -26,10 +29,13 @@ 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 3.15 is the minimum for windows builds (See https://github.com/open-telemetry/opentelemetry-cpp/pull/3349#discussion_r2030319430) + CMAKE_VERSION: '3.15.0' + # cxx14 is the default for windows-2019 CXX_STANDARD: '14' steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -47,6 +53,9 @@ jobs: runs-on: ubuntu-24.04 env: INSTALL_TEST_DIR: '/home/runner/install_test' + # CMake 3.28 is apt package version for Ubuntu 24.04 + CMAKE_VERSION: '3.28.3' + # cxx17 is the default for Ubuntu 24.04 CXX_STANDARD: '17' BUILD_TYPE: 'Debug' steps: @@ -71,12 +80,22 @@ 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' + # Set to the latest version of cmake 3.x + CMAKE_VERSION: '3.31.6' + # Set to the latest cxx standard supported by opentelemetry-cpp CXX_STANDARD: '20' + # Versions below set to the latest version available + # The abseil and protobuf versions are taken from + # the grpc submodules at the GRPC_VERSION tag + GOOGLETEST_VERSION: '1.16.0' + ABSEIL_CPP_VERSION: '20240722.1' + PROTOBUF_VERSION: '29.0' + GRPC_VERSION: 'v1.71.0' BUILD_TYPE: 'Debug' steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -88,10 +107,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 +116,20 @@ 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: + 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 3.22 is the apt package version for Ubuntu 22.04 + CMAKE_VERSION: '3.22.0' CXX_STANDARD: '17' + # These are stable versions tested in the main ci workflow + # and defaults in the devcontainer + 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 +141,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 +154,21 @@ 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' + # Set to the current minimum version of cmake + CMAKE_VERSION: '3.14.0' + # cxx14 is the default for Ubuntu 22.04 CXX_STANDARD: '14' + # This is the apt package version of googletest for Ubuntu 22.04 + GOOGLETEST_VERSION: '1.11.0' + # These are minimum versions tested in the main ci workflow + 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 +180,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 +194,12 @@ 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 3.28 is apt package version for Ubuntu 24.04 + 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 +215,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,10 +232,12 @@ 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' + # Set to the latest version of cmake 3.x + CMAKE_VERSION: '3.31.6' CXX_STANDARD: '17' CMAKE_TOOLCHAIN_FILE: /home/runner/conan/build/Debug/generators/conan_toolchain.cmake BUILD_TYPE: 'Debug' @@ -225,7 +253,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,10 +264,11 @@ 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' + CMAKE_VERSION: '3.28.3' CXX_STANDARD: '17' CMAKE_TOOLCHAIN_FILE: '/Users/runner/conan/build/Debug/generators/conan_toolchain.cmake' BUILD_TYPE: 'Debug' @@ -250,19 +279,22 @@ 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: + INSTALL_TEST_DIR: '/Users/runner/install_test' + # Set to the latest version of cmake 3.x + CMAKE_VERSION: '3.31.6' CXX_STANDARD: '17' BUILD_TYPE: 'Debug' steps: @@ -271,7 +303,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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c5668f161..49274a68e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ Increment the: * [API] Remove `WITH_ABSEIL` and `HAVE_ABSEIL` [#3318](https://github.com/open-telemetry/opentelemetry-cpp/pull/3318) +* [CMAKE] Bump cmake minimum required version to 3.14 + [#3349](https://github.com/open-telemetry/opentelemetry-cpp/pull/3349) + ## [1.20 2025-04-01] * [BUILD] Update opentelemetry-proto version diff --git a/CMakeLists.txt b/CMakeLists.txt index 4414f38002..98b70798c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) # 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 +# 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) # Don't use customized cmake modules if vcpkg is used to resolve dependence. @@ -420,15 +421,32 @@ 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) + + # Protobuf 3.22+ depends on abseil-cpp and must be found using the cmake + # find_package CONFIG 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) + if(NOT Protobuf_FOUND) + find_package(Protobuf MODULE) + if(Protobuf_FOUND AND Protobuf_VERSION VERSION_GREATER_EQUAL "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 +458,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 +520,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 +536,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() # diff --git a/INSTALL.md b/INSTALL.md index 3e12db5a1e..08292d481b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -23,7 +23,9 @@ 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. We use CMake version 3.15.2 in our build system. To install CMake, + unittests. The minimum CMake version is 3.14. + CMake 3.15+ is recommended on Windows due to known CI test failures with 3.14. + To install CMake, consult the [Installing CMake](https://cmake.org/install/) guide. - [GoogleTest](https://github.com/google/googletest) framework to build and run the unittests. Refer to diff --git a/ci/do_ci.ps1 b/ci/do_ci.ps1 index e34d72d5e4..87aa73b6fa 100644 --- a/ci/do_ci.ps1 +++ b/ci/do_ci.ps1 @@ -388,6 +388,8 @@ switch ($action) { -DWITH_ELASTICSEARCH=ON ` -DWITH_ETW=ON ` -DWITH_EXAMPLES=ON ` + -DWITH_EXAMPLES_HTTP=ON ` + -DBUILD_W3CTRACECONTEXT_TEST=ON ` -DOPENTELEMETRY_INSTALL=ON $exit = $LASTEXITCODE @@ -435,19 +437,21 @@ switch ($action) { ) $EXPECTED_COMPONENTS_STRING = $EXPECTED_COMPONENTS -join ";" - cmake -S "$SRC_DIR\install\test\cmake" ` - -B "$BUILD_DIR\install_test" ` - $CMAKE_OPTIONS ` + mkdir "$BUILD_DIR\install_test" + cd "$BUILD_DIR\install_test" + + cmake $CMAKE_OPTIONS ` "-DCMAKE_PREFIX_PATH=$INSTALL_TEST_DIR" ` "-DINSTALL_TEST_CMAKE_OPTIONS=$CMAKE_OPTIONS_STRING" ` - "-DINSTALL_TEST_COMPONENTS=$EXPECTED_COMPONENTS_STRING" + "-DINSTALL_TEST_COMPONENTS=$EXPECTED_COMPONENTS_STRING" ` + -S "$SRC_DIR\install\test\cmake" $exit = $LASTEXITCODE if ($exit -ne 0) { exit $exit } - ctest -C Debug --test-dir "$BUILD_DIR\install_test" --output-on-failure + ctest -C Debug --output-on-failure $exit = $LASTEXITCODE if ($exit -ne 0) { exit $exit @@ -528,20 +532,22 @@ switch ($action) { "ext_dll" ) $EXPECTED_COMPONENTS_STRING = $EXPECTED_COMPONENTS -join ";" - - cmake -S "$SRC_DIR\install\test\cmake" ` - -B "$BUILD_DIR\install_test" ` - $CMAKE_OPTIONS ` + + mkdir "$BUILD_DIR\install_test" + cd "$BUILD_DIR\install_test" + + cmake $CMAKE_OPTIONS ` "-DCMAKE_PREFIX_PATH=$INSTALL_TEST_DIR" ` "-DINSTALL_TEST_CMAKE_OPTIONS=$CMAKE_OPTIONS_STRING" ` - "-DINSTALL_TEST_COMPONENTS=$EXPECTED_COMPONENTS_STRING" + "-DINSTALL_TEST_COMPONENTS=$EXPECTED_COMPONENTS_STRING" ` + -S "$SRC_DIR\install\test\cmake" $exit = $LASTEXITCODE if ($exit -ne 0) { exit $exit } - ctest -C Debug --test-dir "$BUILD_DIR\install_test" --output-on-failure + ctest -C Debug --output-on-failure $exit = $LASTEXITCODE if ($exit -ne 0) { exit $exit diff --git a/ci/do_ci.sh b/ci/do_ci.sh index f81e96469d..24f6707dd6 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -265,13 +265,14 @@ elif [[ "$1" == "cmake.opentracing_shim.install.test" ]]; then "shims_opentracing" ) EXPECTED_COMPONENTS_STRING=$(IFS=\;; echo "${EXPECTED_COMPONENTS[*]}") - cmake -S "${SRC_DIR}/install/test/cmake" \ - -B "${BUILD_DIR}/install_test" \ - "${CMAKE_OPTIONS[@]}" \ + mkdir -p "${BUILD_DIR}/install_test" + cd "${BUILD_DIR}/install_test" + cmake "${CMAKE_OPTIONS[@]}" \ "-DCMAKE_PREFIX_PATH=${INSTALL_TEST_DIR}" \ "-DINSTALL_TEST_CMAKE_OPTIONS=${CMAKE_OPTIONS_STRING}" \ - "-DINSTALL_TEST_COMPONENTS=${EXPECTED_COMPONENTS_STRING}" - ctest --test-dir "${BUILD_DIR}/install_test" --output-on-failure + "-DINSTALL_TEST_COMPONENTS=${EXPECTED_COMPONENTS_STRING}" \ + -S "${SRC_DIR}/install/test/cmake" + ctest --output-on-failure exit 0 elif [[ "$1" == "cmake.c++20.test" ]]; then cd "${BUILD_DIR}" @@ -476,6 +477,8 @@ elif [[ "$1" == "cmake.install.test" ]]; then -DWITH_ZIPKIN=ON \ -DWITH_ELASTICSEARCH=ON \ -DWITH_EXAMPLES=ON \ + -DWITH_EXAMPLES_HTTP=ON \ + -DBUILD_W3CTRACECONTEXT_TEST=ON \ -DOPENTELEMETRY_INSTALL=ON \ "${SRC_DIR}" @@ -502,14 +505,14 @@ elif [[ "$1" == "cmake.install.test" ]]; then "exporters_zipkin" ) EXPECTED_COMPONENTS_STRING=$(IFS=\;; echo "${EXPECTED_COMPONENTS[*]}") - - cmake -S "${SRC_DIR}/install/test/cmake" \ - -B "${BUILD_DIR}/install_test" \ - "${CMAKE_OPTIONS[@]}" \ + mkdir -p "${BUILD_DIR}/install_test" + cd "${BUILD_DIR}/install_test" + cmake "${CMAKE_OPTIONS[@]}" \ "-DCMAKE_PREFIX_PATH=${INSTALL_TEST_DIR}" \ "-DINSTALL_TEST_CMAKE_OPTIONS=${CMAKE_OPTIONS_STRING}" \ - "-DINSTALL_TEST_COMPONENTS=${EXPECTED_COMPONENTS_STRING}" - ctest --test-dir "${BUILD_DIR}/install_test" --output-on-failure + "-DINSTALL_TEST_COMPONENTS=${EXPECTED_COMPONENTS_STRING}" \ + -S "${SRC_DIR}/install/test/cmake" + ctest --output-on-failure exit 0 elif [[ "$1" == "cmake.test_example_plugin" ]]; then # Build the plugin diff --git a/ci/install_protobuf.sh b/ci/install_protobuf.sh index 1fa999d63d..ac041b6334 100755 --- a/ci/install_protobuf.sh +++ b/ci/install_protobuf.sh @@ -70,7 +70,7 @@ if [ -e "../CMakeLists.txt" ]; then else cmake ../cmake "${CPP_PROTOBUF_BUILD_OPTIONS[@]}" fi -cmake --build . -j $(nproc) -cmake --install . +make -j $(nproc) +make install popd ldconfig diff --git a/ci/setup_cmake.ps1 b/ci/setup_cmake.ps1 index dbe332d139..6a9a62fae2 100644 --- a/ci/setup_cmake.ps1 +++ b/ci/setup_cmake.ps1 @@ -12,4 +12,37 @@ choco uninstall cmake cmake.install -y --remove-dependencies --skip-autouninstal Write-Host "Installing CMake version $CMAKE_VERSION ..." choco install cmake --version=$CMAKE_VERSION --allow-downgrade -y --force --no-progress -cmake --version +function Get-Version { + param ( + [string]$output + ) + if ($output -match '(\d+\.\d+\.\d+)') { + return $matches[1] + } + return $null +} + +$cmakeOutput = & cmake --version | Select-Object -First 1 +$ctestOutput = & ctest --version | Select-Object -First 1 +$cpackOutput = & cpack --version | Select-Object -First 1 + +$cmakeVersion = Get-Version $cmakeOutput +$ctestVersion = Get-Version $ctestOutput +$cpackVersion = Get-Version $cpackOutput + +Write-Host "cmake version $cmakeVersion detected" +Write-Host "ctest version $ctestVersion detected" +Write-Host "cpack version $cpackVersion detected" + +if ($cmakeVersion -ne $CMAKE_VERSION) { + Write-Error "CMake version mismatch: expected $CMAKE_VERSION, installed $cmakeVersion" + exit 1 +} +if ($ctestVersion -ne $CMAKE_VERSION) { + Write-Error "CTest version mismatch: expected $CMAKE_VERSION, installed $ctestVersion" + exit 1 +} +if ($cpackVersion -ne $CMAKE_VERSION) { + Write-Error "CPack version mismatch: expected $CMAKE_VERSION, installed $cpackVersion" + exit 1 +} diff --git a/ci/setup_cmake.sh b/ci/setup_cmake.sh index e6e297e338..365b3e01ba 100755 --- a/ci/setup_cmake.sh +++ b/ci/setup_cmake.sh @@ -6,27 +6,43 @@ set -e CMAKE_VERSION=${CMAKE_VERSION:-3.31.6} -CMAKE_DIR="cmake-$CMAKE_VERSION-linux-x86_64" -CMAKE_TAR="$CMAKE_DIR.tar.gz" -CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/$CMAKE_TAR" +CMAKE_DIR="cmake-${CMAKE_VERSION}-linux-x86_64" +CMAKE_TAR="${CMAKE_DIR}.tar.gz" +CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_TAR}" -echo "Installing CMake version: $CMAKE_VERSION" +INSTALL_DIR="/opt/cmake" + +echo "Installing CMake version: ${CMAKE_VERSION}..." apt-get update && apt-get remove --purge -y cmake || true apt-get install -y wget tar -wget "$CMAKE_URL" - -tar -xzf "$CMAKE_TAR" +wget "${CMAKE_URL}" -mkdir -p /opt/cmake -mv "$CMAKE_DIR" /opt/cmake/cmake +mkdir -p "${INSTALL_DIR}" +tar --strip-components=1 -xzf "${CMAKE_TAR}" -C "${INSTALL_DIR}" -for file in /opt/cmake/cmake/bin/*; do - ln -sf "$file" "/usr/local/bin/$(basename "$file")" +for executable in "${INSTALL_DIR}/bin/"*; do + exe_name=$(basename "$executable") + ln -sf "$executable" "/usr/local/bin/$exe_name" done -rm -f "$CMAKE_TAR" +rm -f "${CMAKE_TAR}" + +echo "Verifying installed versions..." + +for executable in cmake ctest cpack; do + if command -v "$executable" >/dev/null 2>&1; then + ACTUAL_VERSION=$("$executable" --version | grep -Eo '[0-9]+(\.[0-9]+)*' | head -n 1) + echo "$executable version: $ACTUAL_VERSION detected" + if [ "$ACTUAL_VERSION" != "$CMAKE_VERSION" ]; then + echo "E: $executable version mismatch. Expected $CMAKE_VERSION, found '$ACTUAL_VERSION'" >&2 + exit 1 + fi + else + echo "E: $executable is not installed or not in PATH." >&2 + exit 1 + fi +done -cmake --version diff --git a/ci/setup_cmake_macos.sh b/ci/setup_cmake_macos.sh index 5208c9cd24..54cbdae5e2 100755 --- a/ci/setup_cmake_macos.sh +++ b/ci/setup_cmake_macos.sh @@ -11,30 +11,41 @@ CMAKE_TAR="${CMAKE_PKG}.tar.gz" CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_TAR}" INSTALL_DIR="/opt/cmake" -BIN_DIR="${INSTALL_DIR}/cmake/CMake.app/Contents/bin" echo "Installing CMake version ${CMAKE_VERSION}..." -if brew list cmake >/dev/null 2>&1; then - echo "Removing existing Homebrew-installed CMake..." - brew uninstall cmake -fi +brew uninstall cmake || true if ! command -v wget >/dev/null 2>&1; then - echo "wget not found. Installing wget via Homebrew..." + echo "Installing wget..." brew install wget fi wget -q "${CMAKE_URL}" -tar -xzf "${CMAKE_TAR}" - sudo mkdir -p "${INSTALL_DIR}" -sudo mv "${CMAKE_PKG}" "${INSTALL_DIR}/cmake" +sudo tar --strip-components=1 -xzf "${CMAKE_TAR}" -C "${INSTALL_DIR}" -for file in "${BIN_DIR}"/*; do - sudo ln -sf "${file}" "/usr/local/bin/$(basename "${file}")" +BINARY_DIR="${INSTALL_DIR}/CMake.app/Contents/bin" + +for executable in "${BINARY_DIR}/"*; do + exe_name=$(basename "$executable") + sudo ln -sf "$executable" "/usr/local/bin/$exe_name" done rm -f "${CMAKE_TAR}" -cmake --version +echo "Verifying installed versions..." + +for executable in cmake ctest cpack; do + if command -v "$executable" >/dev/null 2>&1; then + ACTUAL_VERSION=$("$executable" --version | grep -Eo '[0-9]+(\.[0-9]+)*' | head -n 1) + echo "$executable version: $ACTUAL_VERSION detected" + if [ "$ACTUAL_VERSION" != "$CMAKE_VERSION" ]; then + echo "E: $executable version mismatch. Expected $CMAKE_VERSION, found '$ACTUAL_VERSION'" >&2 + exit 1 + fi + else + echo "E: $executable is not installed or not in PATH." >&2 + exit 1 + fi +done diff --git a/ci/setup_grpc.sh b/ci/setup_grpc.sh index 056cc089d7..c922af50c7 100755 --- a/ci/setup_grpc.sh +++ b/ci/setup_grpc.sh @@ -114,7 +114,9 @@ if [[ $build_internal_abseil_cpp -ne 0 ]]; then ABSEIL_CPP_BUILD_OPTIONS=(${ABSEIL_CPP_BUILD_OPTIONS[@]} "-DBUILD_SHARED_LIBS=$build_shared_libs") fi cmake "${ABSEIL_CPP_BUILD_OPTIONS[@]}" .. - cmake --build . -j${nproc} --target install && popd + make -j $(nproc) + make install + popd fi mkdir -p build && pushd build @@ -144,8 +146,8 @@ echo "Building gRPC ${install_grpc_version}" echo "CMake build options:" "${GRPC_BUILD_OPTIONS[@]}" cmake "${GRPC_BUILD_OPTIONS[@]}" .. -cmake --build . -j$(nproc) -cmake --install . +make -j $(nproc) +make install popd popd diff --git a/cmake/patch-imported-config.cmake b/cmake/patch-imported-config.cmake index b49903eb29..364d5407d4 100644 --- a/cmake/patch-imported-config.cmake +++ b/cmake/patch-imported-config.cmake @@ -9,7 +9,7 @@ project_build_tools_patch_default_imported_config(ZLIB::ZLIB) # protobuf targets -if(Protobuf_FOUND OR PROTOBUF_FOUND) +if(Protobuf_FOUND) project_build_tools_patch_default_imported_config( utf8_range::utf8_range utf8_range::utf8_validity protobuf::libprotobuf-lite protobuf::libprotobuf protobuf::libprotoc) diff --git a/cmake/templates/thirdparty-built-with-flags.cmake.in b/cmake/templates/thirdparty-built-with-flags.cmake.in index c893332ad4..b6b5175b82 100644 --- a/cmake/templates/thirdparty-built-with-flags.cmake.in +++ b/cmake/templates/thirdparty-built-with-flags.cmake.in @@ -35,7 +35,7 @@ endif() # Protobuf: # Expected TRUE if protobuf was found during the build -if("@Protobuf_FOUND@" OR "@PROTOBUF_FOUND@") +if("@Protobuf_FOUND@") set(BUILT_WITH_Protobuf TRUE) endif() @@ -58,7 +58,7 @@ endif() # Third party dependency versions #----------------------------------------------------------------------- if(BUILT_WITH_CURL) - set(BUILT_WITH_CURL_VERSION @CURL_VERSION_STRING@) + set(BUILT_WITH_CURL_VERSION @CURL_VERSION@) endif() if(BUILT_WITH_ZLIB) diff --git a/cmake/tools.cmake b/cmake/tools.cmake index 43c1a7b43f..ffc3732d2b 100644 --- a/cmake/tools.cmake +++ b/cmake/tools.cmake @@ -94,6 +94,15 @@ function(patch_protobuf_targets) endfunction() function(project_build_tools_get_imported_location OUTPUT_VAR_NAME TARGET_NAME) + + # The following if statement was added to support cmake versions < 3.19 + get_target_property(TARGET_TYPE ${TARGET_NAME} TYPE) + if(TARGET_TYPE STREQUAL "INTERFACE_LIBRARY") + # For interface libraries, do not attempt to retrieve imported location. + set(${OUTPUT_VAR_NAME} "" PARENT_SCOPE) + return() + endif() + if(CMAKE_BUILD_TYPE) string(TOUPPER "IMPORTED_LOCATION_${CMAKE_BUILD_TYPE}" TRY_SPECIFY_IMPORTED_LOCATION) diff --git a/docker/grpc/CMakeLists.txt b/docker/grpc/CMakeLists.txt index 7254da1dcc..95ddf7db82 100644 --- a/docker/grpc/CMakeLists.txt +++ b/docker/grpc/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.11 FATAL_ERROR) +cmake_minimum_required(VERSION 3.14 FATAL_ERROR) project( dependencies diff --git a/install/conan/conanfile_stable.txt b/install/conan/conanfile_stable.txt index 94d87c1632..f9b1f36b7c 100644 --- a/install/conan/conanfile_stable.txt +++ b/install/conan/conanfile_stable.txt @@ -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 opentracing-cpp/1.6.0 [options] @@ -30,7 +30,7 @@ pcre2/*:with_bzip2=False [test_requires] gtest/1.14.0 -benchmark/1.9.1 +benchmark/1.8.3 [generators] CMakeToolchain diff --git a/install/test/cmake/CMakeLists.txt b/install/test/cmake/CMakeLists.txt index 1c8b69fc07..fc6227894e 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.10) +cmake_minimum_required(VERSION 3.14) 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 e4a963ab81..271255f587 100644 --- a/install/test/cmake/component_tests/api/CMakeLists.txt +++ b/install/test/cmake/component_tests/api/CMakeLists.txt @@ -1,13 +1,13 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-api-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS api) -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(api_test ${INSTALL_TEST_SRC_DIR}/test_api.cc) diff --git a/install/test/cmake/component_tests/exporters_elasticsearch/CMakeLists.txt b/install/test/cmake/component_tests/exporters_elasticsearch/CMakeLists.txt index 3019aa1d2a..9b2d7ef1ab 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters-elasticsearch-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_elasticsearch) @@ -10,7 +10,7 @@ if(NOT TARGET nlohmann_json::nlohmann_json) message(FATAL_ERROR "nlohmann_json::nlohmann_json target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_elasticsearch_test diff --git a/install/test/cmake/component_tests/exporters_etw/CMakeLists.txt b/install/test/cmake/component_tests/exporters_etw/CMakeLists.txt index 4860a2f1f5..b2dcb302b0 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters_etw-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_etw) @@ -10,7 +10,7 @@ if(NOT TARGET nlohmann_json::nlohmann_json) message(FATAL_ERROR "nlohmann_json::nlohmann_json target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_etw_test ${INSTALL_TEST_SRC_DIR}/test_exporters_etw.cc) 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 e24b7761fa..ca3ab3e32e 100644 --- a/install/test/cmake/component_tests/exporters_in_memory/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_in_memory/CMakeLists.txt @@ -1,12 +1,12 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters-in-memory-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_in_memory) -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_in_memory_test diff --git a/install/test/cmake/component_tests/exporters_ostream/CMakeLists.txt b/install/test/cmake/component_tests/exporters_ostream/CMakeLists.txt index eec0f26a7e..2028b4b92a 100644 --- a/install/test/cmake/component_tests/exporters_ostream/CMakeLists.txt +++ b/install/test/cmake/component_tests/exporters_ostream/CMakeLists.txt @@ -1,12 +1,12 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters-ostream-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_ostream) -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_ostream_test 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 e7bd38fe1f..a9d9a0c275 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters-otlp-common-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_otlp_common) @@ -10,7 +10,7 @@ if(NOT TARGET protobuf::libprotobuf) message(FATAL_ERROR "protobuf::libprotobuf target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_otlp_common_test 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 e625a73bb3..11d79dfd6d 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters-otlp-file-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_otlp_file) @@ -10,7 +10,7 @@ if(NOT TARGET protobuf::libprotobuf) message(FATAL_ERROR "protobuf::libprotobuf target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_otlp_file_test 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 62665d10c8..6e9b4b6b91 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters-otlp-grpc-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_otlp_grpc) @@ -14,7 +14,7 @@ if(NOT TARGET gRPC::grpc++) message(FATAL_ERROR "gRPC::grpc++ target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_otlp_grpc_test 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 ca555c05cc..09b4f433de 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters-otlp-http-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_otlp_http) @@ -10,7 +10,7 @@ if(NOT TARGET protobuf::libprotobuf) message(FATAL_ERROR "protobuf::libprotobuf target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_otlp_http_test diff --git a/install/test/cmake/component_tests/exporters_prometheus/CMakeLists.txt b/install/test/cmake/component_tests/exporters_prometheus/CMakeLists.txt index 78eaa26136..526a01626d 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters-prometheus-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_prometheus) @@ -10,7 +10,7 @@ if(NOT TARGET prometheus-cpp::core) message(FATAL_ERROR "prometheus-cpp::core target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_prometheus_test diff --git a/install/test/cmake/component_tests/exporters_zipkin/CMakeLists.txt b/install/test/cmake/component_tests/exporters_zipkin/CMakeLists.txt index cbbb7ba887..378794bceb 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-exporters-zipkin-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS exporters_zipkin) @@ -10,7 +10,7 @@ if(NOT TARGET nlohmann_json::nlohmann_json) message(FATAL_ERROR "nlohmann_json::nlohmann_json target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(exporters_zipkin_test diff --git a/install/test/cmake/component_tests/ext_common/CMakeLists.txt b/install/test/cmake/component_tests/ext_common/CMakeLists.txt index 0d6abde19f..c80058318b 100644 --- a/install/test/cmake/component_tests/ext_common/CMakeLists.txt +++ b/install/test/cmake/component_tests/ext_common/CMakeLists.txt @@ -1,12 +1,12 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-ext_common-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS ext_common) -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(ext_common_test ${INSTALL_TEST_SRC_DIR}/test_ext_common.cc) diff --git a/install/test/cmake/component_tests/ext_dll/CMakeLists.txt b/install/test/cmake/component_tests/ext_dll/CMakeLists.txt index bfff138544..3e9dd8565c 100644 --- a/install/test/cmake/component_tests/ext_dll/CMakeLists.txt +++ b/install/test/cmake/component_tests/ext_dll/CMakeLists.txt @@ -1,14 +1,14 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-ext_dll-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS ext_dll) add_definitions(-DOPENTELEMETRY_BUILD_IMPORT_DLL) -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(ext_dll_test ${INSTALL_TEST_SRC_DIR}/test_ext_dll.cc) 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 caafd3e766..f9adda65cf 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-ext_http_curl-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS ext_http_curl) @@ -10,7 +10,7 @@ if(NOT TARGET CURL::libcurl) message(FATAL_ERROR "CURL::libcurl target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(ext_http_curl_test ${INSTALL_TEST_SRC_DIR}/test_ext_http_curl.cc) diff --git a/install/test/cmake/component_tests/sdk/CMakeLists.txt b/install/test/cmake/component_tests/sdk/CMakeLists.txt index 9dd828b65c..1dd110231d 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-sdk-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS sdk) @@ -10,7 +10,7 @@ if(NOT TARGET Threads::Threads) message(FATAL_ERROR "Threads::Threads target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(sdk_test ${INSTALL_TEST_SRC_DIR}/test_sdk.cc) diff --git a/install/test/cmake/component_tests/shims_opentracing/CMakeLists.txt b/install/test/cmake/component_tests/shims_opentracing/CMakeLists.txt index 34187da294..f541f15dd2 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-shims_opentracing-install-test LANGUAGES CXX) find_package(opentelemetry-cpp REQUIRED COMPONENTS shims_opentracing) @@ -10,7 +10,7 @@ if(NOT TARGET OpenTracing::opentracing) message(FATAL_ERROR "OpenTracing::opentracing target not found") endif() -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(shims_opentracing_test diff --git a/install/test/cmake/package_test/CMakeLists.txt b/install/test/cmake/package_test/CMakeLists.txt index b14c91bffb..63f5bf4248 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-full-package-install-test LANGUAGES CXX) @@ -60,7 +60,7 @@ message( "Testing the full package install on components = ${INSTALL_TEST_COMPONENTS}" ) -find_package(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) include(GoogleTest) add_executable(full_test) diff --git a/install/test/cmake/usage_tests/missing_components/CMakeLists.txt b/install/test/cmake/usage_tests/missing_components/CMakeLists.txt index c93d558c8a..adbf5fd8fd 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.10) +cmake_minimum_required(VERSION 3.14) 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 9d9521ad79..17fec851d7 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.10) +cmake_minimum_required(VERSION 3.14) 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 0331e97046..3fdd175a15 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.10) +cmake_minimum_required(VERSION 3.14) 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 6c9bea709c..43ab06c0b6 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.10) +cmake_minimum_required(VERSION 3.14) project(opentelemetry-cpp-unsupported-components-install-test LANGUAGES CXX)