Skip to content

Commit a9ea1ab

Browse files
committed
relocate and consolidate checks
1 parent 68fd35a commit a9ea1ab

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

cmake/GoogleCloudCppFeatures.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,13 @@ macro (google_cloud_cpp_enable_cleanup)
403403
set(GOOGLE_CLOUD_CPP_ENABLE_REST ON)
404404
endif ()
405405

406+
# We need the REST libraries for the full suite of samples.
407+
if (NOT GOOGLE_CLOUD_CPP_ENABLE_REST
408+
AND BUILD_TESTING
409+
AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
410+
set(GOOGLE_CLOUD_CPP_ENABLE_REST ON)
411+
endif ()
412+
406413
list(REMOVE_DUPLICATES GOOGLE_CLOUD_CPP_ENABLE)
407414
endmacro ()
408415

google/cloud/CMakeLists.txt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ mark_as_advanced(GOOGLE_CLOUD_CPP_BUILD_METADATA)
5252

5353
include("${CMAKE_CURRENT_SOURCE_DIR}/google_cloud_cpp_common.cmake")
5454

55-
# We need the REST libraries for the full suite of samples.
56-
if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
57-
set(GOOGLE_CLOUD_CPP_ENABLE_REST ON)
58-
endif ()
59-
6055
add_subdirectory(testing_util)
6156

6257
if (GOOGLE_CLOUD_CPP_ENABLE_GRPC)
@@ -73,14 +68,11 @@ if (GOOGLE_CLOUD_CPP_ENABLE_REST AND GOOGLE_CLOUD_CPP_ENABLE_GRPC)
7368
)
7469
endif ()
7570

76-
if (universe_domain IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
77-
include(
78-
"${CMAKE_CURRENT_SOURCE_DIR}/google_cloud_cpp_universe_domain.cmake")
79-
add_subdirectory(universe_domain)
80-
endif ()
81-
82-
# We need the universe_domain library for the full suite of samples.
83-
if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
71+
# We need the universe_domain library for the full suite of samples if it isn't
72+
# already enabled.
73+
if (universe_domain IN_LIST GOOGLE_CLOUD_CPP_ENABLE
74+
OR BUILD_TESTING
75+
AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
8476
include(
8577
"${CMAKE_CURRENT_SOURCE_DIR}/google_cloud_cpp_universe_domain.cmake")
8678
add_subdirectory(universe_domain)

0 commit comments

Comments
 (0)