From 468d1e8c7aa638ccca9d8dc3e38a85cf5f99005c Mon Sep 17 00:00:00 2001 From: owent Date: Mon, 25 Nov 2024 11:41:55 +0800 Subject: [PATCH 1/2] Upgrade cmake Downgrade cmake minimal requirement Add some policy settings to cmake --- CMakeLists.txt | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 177296d81c..8e8f58e19b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,23 +1,38 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.10) -# See https://cmake.org/cmake/help/v3.3/policy/CMP0057.html required by certain -# versions of gtest +# These policies belowed are used to keep a more strick behavior of cmake +cmake_policy(SET CMP0054 NEW) +cmake_policy(SET CMP0067 NEW) + +# See https://cmake.org/cmake/help/latest/policy/CMP0057.html required by +# certain versions of gtest cmake_policy(SET CMP0057 NEW) -# See https://cmake.org/cmake/help/v3.12/policy/CMP0074.html required by certain -# version of zlib which CURL depends on. +# 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() +# MSVC RTTI flag /GR should not be not 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) +endif() + project(opentelemetry-cpp) # Mark variables as used so cmake doesn't complain about them From 3f4c133c1b8a4b8786634ce77072b83136ba0b3b Mon Sep 17 00:00:00 2001 From: owent Date: Mon, 2 Dec 2024 11:22:39 +0800 Subject: [PATCH 2/2] cleanup cmake policies --- CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e8f58e19b..6abf96cd99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,14 +3,6 @@ cmake_minimum_required(VERSION 3.10) -# These policies belowed are used to keep a more strick behavior of cmake -cmake_policy(SET CMP0054 NEW) -cmake_policy(SET CMP0067 NEW) - -# See https://cmake.org/cmake/help/latest/policy/CMP0057.html required by -# certain versions of gtest -cmake_policy(SET CMP0057 NEW) - # 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")