Skip to content

Commit

Permalink
[google-cloud-cpp] Skip building mock libraries. (#39802)
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-tsirpanis authored Jul 10, 2024
1 parent 1b5f734 commit 3389f50
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
22 changes: 22 additions & 0 deletions ports/google-cloud-cpp/fix_mocks_dependent_option.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1a1dc8..807f6e2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -173,7 +173,7 @@ provided mocks to test code involving the Cloud C++ clients may wish to turn
this flag off.]==]
ON
"NOT BUILD_TESTING"
- ON)
+ $<IF:$<BOOL:${BUILD_TESTING}>:OFF:ON>)
mark_as_advanced(GOOGLE_CLOUD_CPP_WITH_MOCKS)

# The examples use exception handling to simplify the code. Therefore they
@@ -246,7 +246,7 @@ include(CTest)
# used in the depends condition of the next option.
include(EnableCxxExceptions)

-if (BUILD_TESTING)
+if (BUILD_TESTING OR GOOGLE_CLOUD_CPP_WITH_MOCKS)
# Discover and add targets for the GTest::gtest and GTest::gmock libraries.
include(FindGMockWithTargets)
endif ()
2 changes: 2 additions & 0 deletions ports/google-cloud-cpp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ vcpkg_from_github(
HEAD_REF main
PATCHES
support_absl_cxx17.patch
fix_mocks_dependent_option.patch
)

if ("grpc-common" IN_LIST FEATURES)
Expand Down Expand Up @@ -48,6 +49,7 @@ vcpkg_cmake_configure(
-DGOOGLE_CLOUD_CPP_ENABLE_CCACHE=OFF
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
-DBUILD_TESTING=OFF
-DGOOGLE_CLOUD_CPP_WITH_MOCKS=OFF
)

vcpkg_cmake_install()
Expand Down
1 change: 1 addition & 0 deletions ports/google-cloud-cpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "google-cloud-cpp",
"version": "2.26.0",
"port-version": 1,
"description": "C++ Client Libraries for Google Cloud Platform APIs.",
"homepage": "https://github.com/googleapis/google-cloud-cpp",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3154,7 +3154,7 @@
},
"google-cloud-cpp": {
"baseline": "2.26.0",
"port-version": 0
"port-version": 1
},
"google-cloud-cpp-common": {
"baseline": "alias",
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/google-cloud-cpp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "79809a3d4f368d9afe5eac6f10d892311b464e00",
"version": "2.26.0",
"port-version": 1
},
{
"git-tree": "6f92046f144ea5804abafe724ea2fec115dad148",
"version": "2.26.0",
Expand Down

0 comments on commit 3389f50

Please sign in to comment.