-
Notifications
You must be signed in to change notification settings - Fork 422
Closed
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Does this issue affect the google-cloud-cpp project?
Yes.
What component of google-cloud-cpp
is this related to?
The entire project, but I am testing with pubsub.
Describe the bug
When using CMake's FetchContent in order to fetch google-cloud-cpp, it attempts to export gmock and test targets even when building with BUILD_TESTING=OFF
.
To Reproduce Steps to reproduce the behavior:
Add the following to your CMake project which has proper install commands already:
FetchContent_Declare(
google-cloud-sdk
URL https://github.com/googleapis/google-cloud-cpp/archive/${google_cloud_version}.tar.gz
)
set(BUILD_TESTING OFF)
set(GOOGLE_CLOUD_CPP_ENABLE_EXAMPLES OFF)
set(GOOGLE_CLOUD_CPP_ENABLE "pubsub")
FetchContent_MakeAvailable(google-cloud-sdk)
You will get the following errors:
CMake Error: install(EXPORT "google_cloud_cpp_mocks-targets" ...) includes target "google_cloud_cpp_mocks" which requires target "gmock_main" that is not in any export set.
CMake Error: install(EXPORT "google_cloud_cpp_mocks-targets" ...) includes target "google_cloud_cpp_mocks" which requires target "gmock" that is not in any export set.
CMake Error: install(EXPORT "google_cloud_cpp_mocks-targets" ...) includes target "google_cloud_cpp_mocks" which requires target "gtest" that is not in any export set.
CMake Error: install(EXPORT "google_cloud_cpp_iam_mocks-targets" ...) includes target "google_cloud_cpp_iam_mocks" which requires target "gmock_main" that is not in any export set.
CMake Error: install(EXPORT "google_cloud_cpp_iam_mocks-targets" ...) includes target "google_cloud_cpp_iam_mocks" which requires target "gmock" that is not in any export set.
CMake Error: install(EXPORT "google_cloud_cpp_iam_mocks-targets" ...) includes target "google_cloud_cpp_iam_mocks" which requires target "gtest" that is not in any export set.
CMake Error: install(EXPORT "pubsub_mocks-targets" ...) includes target "google_cloud_cpp_pubsub_mocks" which requires target "gmock_main" that is not in any export set.
CMake Error: install(EXPORT "pubsub_mocks-targets" ...) includes target "google_cloud_cpp_pubsub_mocks" which requires target "gmock" that is not in any export set.
CMake Error: install(EXPORT "pubsub_mocks-targets" ...) includes target "google_cloud_cpp_pubsub_mocks" which requires target "gtest" that is not in any export set.
Expected behavior
No errors. I expect BUILD_TESTING=OFF
to not export any target related to testing.
Operating system:
macOS Sonoma 14.1.2 (23B92)
What compiler and version are you using?
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
What version of google-cloud-cpp
are you using?
v2.21.0
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.