Skip to content

Commit f8d1216

Browse files
authored
fix(bigtable): the mocks library is no longer header-only (#9568)
The library is no longer header-only, it needs to become a real library.
1 parent 29ff9d3 commit f8d1216

1 file changed

Lines changed: 24 additions & 30 deletions

File tree

google/cloud/bigtable/CMakeLists.txt

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,6 @@ include(CTest)
3535
# Export the version information for Bazel.
3636
include(CreateBazelConfig)
3737

38-
# Create a header-only library for the mocks. We use a CMake `INTERFACE` library
39-
# for these, a regular library would not work on macOS (where the library needs
40-
# at least one .o file). Unfortunately INTERFACE libraries are a bit weird in
41-
# that they need absolute paths for their sources.
42-
add_library(google_cloud_cpp_bigtable_mocks INTERFACE)
43-
target_sources(
44-
google_cloud_cpp_bigtable_mocks
45-
INTERFACE
46-
${CMAKE_CURRENT_SOURCE_DIR}/admin/mocks/mock_bigtable_instance_admin_connection.h
47-
${CMAKE_CURRENT_SOURCE_DIR}/admin/mocks/mock_bigtable_table_admin_connection.h
48-
${CMAKE_CURRENT_SOURCE_DIR}/mocks/mock_data_connection.h
49-
${CMAKE_CURRENT_SOURCE_DIR}/mocks/mock_row_reader.cc
50-
${CMAKE_CURRENT_SOURCE_DIR}/mocks/mock_row_reader.h)
51-
target_link_libraries(
52-
google_cloud_cpp_bigtable_mocks
53-
INTERFACE google-cloud-cpp::bigtable GTest::gmock_main GTest::gmock
54-
GTest::gtest)
55-
set_target_properties(google_cloud_cpp_bigtable_mocks
56-
PROPERTIES EXPORT_NAME google-cloud-cpp::bigtable_mocks)
57-
create_bazel_config(google_cloud_cpp_bigtable_mocks YEAR "2021")
58-
target_include_directories(
59-
google_cloud_cpp_bigtable_mocks
60-
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
61-
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
62-
$<INSTALL_INTERFACE:include>)
63-
target_compile_options(google_cloud_cpp_bigtable_mocks
64-
INTERFACE ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
65-
add_library(google-cloud-cpp::bigtable_mocks ALIAS
66-
google_cloud_cpp_bigtable_mocks)
67-
6838
# the client library
6939
add_library(
7040
google_cloud_cpp_bigtable # cmake-format: sort
@@ -273,6 +243,30 @@ add_library(google-cloud-cpp::bigtable ALIAS google_cloud_cpp_bigtable)
273243
include(CreateBazelConfig)
274244
create_bazel_config(google_cloud_cpp_bigtable)
275245

246+
add_library(
247+
google_cloud_cpp_bigtable_mocks # cmake-format: sort
248+
admin/mocks/mock_bigtable_instance_admin_connection.h
249+
admin/mocks/mock_bigtable_table_admin_connection.h
250+
mocks/mock_data_connection.h
251+
mocks/mock_row_reader.cc
252+
mocks/mock_row_reader.h)
253+
target_link_libraries(
254+
google_cloud_cpp_bigtable_mocks
255+
PUBLIC google-cloud-cpp::bigtable
256+
INTERFACE GTest::gmock_main GTest::gmock GTest::gtest)
257+
set_target_properties(google_cloud_cpp_bigtable_mocks
258+
PROPERTIES EXPORT_NAME google-cloud-cpp::bigtable_mocks)
259+
create_bazel_config(google_cloud_cpp_bigtable_mocks YEAR "2021")
260+
target_include_directories(
261+
google_cloud_cpp_bigtable_mocks
262+
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
263+
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
264+
$<INSTALL_INTERFACE:include>)
265+
target_compile_options(google_cloud_cpp_bigtable_mocks
266+
INTERFACE ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
267+
add_library(google-cloud-cpp::bigtable_mocks ALIAS
268+
google_cloud_cpp_bigtable_mocks)
269+
276270
if (BUILD_TESTING)
277271
add_library(
278272
bigtable_client_testing # cmake-format: sort

0 commit comments

Comments
 (0)