From f3d4abb22f5d3cd918fbd0ebd15433de20d9fb67 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis <teo@tsirpanis.gr> Date: Fri, 15 Mar 2024 06:07:46 +0200 Subject: [PATCH] cleanup(cmake): delete `SelectMSVCRuntime.cmake` (#13777) Vcpkg already contains this logic by itself and it might produce wrong results if vcpkg is not being used. --- CMakeLists.txt | 1 - cmake/GoogleCloudCppCommon.cmake | 3 --- cmake/SelectMSVCRuntime.cmake | 38 ------------------------------ examples/CMakeLists.txt | 3 --- external/googleapis/CMakeLists.txt | 2 -- 5 files changed, 47 deletions(-) delete mode 100644 cmake/SelectMSVCRuntime.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d028829b54ea..82022f12618fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") endif () list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -include(SelectMSVCRuntime) option(GOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK "If enabled, check that the user has defined OPENSSL_ROOT_DIR on macOS" diff --git a/cmake/GoogleCloudCppCommon.cmake b/cmake/GoogleCloudCppCommon.cmake index 9ad0c3144ab66..3734a6bc5dd28 100644 --- a/cmake/GoogleCloudCppCommon.cmake +++ b/cmake/GoogleCloudCppCommon.cmake @@ -17,9 +17,6 @@ # Get the destination directories based on the GNU recommendations. include(GNUInstallDirs) -# Pick the right MSVC runtime libraries. -include(SelectMSVCRuntime) - # Enable Werror include(EnableWerror) diff --git a/cmake/SelectMSVCRuntime.cmake b/cmake/SelectMSVCRuntime.cmake deleted file mode 100644 index 91b28a2660534..0000000000000 --- a/cmake/SelectMSVCRuntime.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# ~~~ -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ~~~ - -# When compiling against *-static vcpkg packages we need to use the static C++ -# runtime with MSVC. The default is to use the dynamic runtime, which does not -# work in this case. This seems to be the recommended way to change the -# runtime: -# -# ~~~ -# https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-can-i-build-my-msvc-application-with-a-static-runtime -# ~~~ -# -# Note that currently we use VCPKG_TARGET_TRIPLET to determine if the static -# runtime is needed. In the future we may need to use a more complex expression -# to determine this, but this is a good start. -# - -if (MSVC) - if (VCPKG_TARGET_TRIPLET MATCHES "-static$") - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") - else () - set(CMAKE_MSVC_RUNTIME_LIBRARY - "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL") - endif () -endif () diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ce44aafea411d..cdaba904a20cd 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -20,9 +20,6 @@ if (NOT GOOGLE_CLOUD_CPP_ENABLE_EXAMPLES) return() endif () -# Pick the right MSVC runtime libraries. -include(SelectMSVCRuntime) - if (bigtable IN_LIST GOOGLE_CLOUD_CPP_ENABLE AND storage IN_LIST GOOGLE_CLOUD_CPP_ENABLE) add_executable(gcs2cbt gcs2cbt.cc) diff --git a/external/googleapis/CMakeLists.txt b/external/googleapis/CMakeLists.txt index 0ba0a59fd2aa1..e33a834a5d96e 100644 --- a/external/googleapis/CMakeLists.txt +++ b/external/googleapis/CMakeLists.txt @@ -164,8 +164,6 @@ externalproject_add( google_cloud_cpp_find_proto_include_dir(PROTO_INCLUDE_DIR) -include(SelectMSVCRuntime) - google_cloud_cpp_add_protos_property() function (external_googleapis_short_name var proto)