Skip to content

Commit b034484

Browse files
martinzinkcoryan
andauthored
fix: use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#8477)
Co-authored-by: Carlos O'Ryan <coryan@google.com>
1 parent c1ce073 commit b034484

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,12 @@ function (google_cloud_cpp_enable_features)
300300
add_subdirectory(google/cloud/storage)
301301
endif ()
302302
else ()
303-
if (NOT IS_DIRECTORY "${CMAKE_SOURCE_DIR}/google/cloud/${feature}"
304-
OR NOT EXISTS
305-
"${CMAKE_SOURCE_DIR}/google/cloud/${feature}/CMakeLists.txt")
303+
if (NOT IS_DIRECTORY
304+
"${CMAKE_CURRENT_SOURCE_DIR}/google/cloud/${feature}"
305+
OR NOT
306+
EXISTS
307+
"${CMAKE_CURRENT_SOURCE_DIR}/google/cloud/${feature}/CMakeLists.txt"
308+
)
306309
message(
307310
WARNING
308311
"${feature} is not a valid feature in google-cloud-cpp, ignored"
@@ -312,15 +315,17 @@ function (google_cloud_cpp_enable_features)
312315
add_subdirectory(google/cloud/${feature})
313316
if (GOOGLE_CLOUD_CPP_ENABLE_EXAMPLES
314317
AND IS_DIRECTORY
315-
"${CMAKE_SOURCE_DIR}/google/cloud/${feature}/samples")
318+
"${CMAKE_CURRENT_SOURCE_DIR}/google/cloud/${feature}/samples"
319+
)
316320
add_subdirectory(google/cloud/${feature}/samples)
317321
endif ()
318322
# Older libraries used examples/ to host their examples. The
319323
# directory name cannot be easily changed as cloud.google.com
320324
# references these files explicitly.
321325
if (GOOGLE_CLOUD_CPP_ENABLE_EXAMPLES
322326
AND IS_DIRECTORY
323-
"${CMAKE_SOURCE_DIR}/google/cloud/${feature}/examples")
327+
"${CMAKE_CURRENT_SOURCE_DIR}/google/cloud/${feature}/examples"
328+
)
324329
add_subdirectory(google/cloud/${feature}/examples)
325330
endif ()
326331
endif ()

0 commit comments

Comments
 (0)