@@ -253,6 +253,22 @@ function (google_cloud_cpp_add_gapic_library library display_name)
253253
254254 add_library (${library_alias} ALIAS ${library_target} )
255255
256+ unset (transition_target)
257+ if (_opt_TRANSITION)
258+ # Define an interface library to allow for a smoother transition from
259+ # `experimental-foo` -> `foo`.
260+ set (transition_target "google_cloud_cpp_experimental_${library} " )
261+ set (transition_alias "google-cloud-cpp::experimental-${library} " )
262+ add_library (${transition_target} INTERFACE )
263+ set_target_properties (${transition_target}
264+ PROPERTIES EXPORT_NAME ${transition_alias} )
265+ target_link_libraries (
266+ ${transition_target}
267+ PUBLIC
268+ INTERFACE ${library_alias} )
269+ add_library (${transition_alias} ALIAS ${transition_target} )
270+ endif ()
271+
256272 # Get the destination directories based on the GNU recommendations.
257273 include (GNUInstallDirs)
258274
@@ -266,7 +282,7 @@ function (google_cloud_cpp_add_gapic_library library display_name)
266282 # GNUInstallDirs
267283 install (
268284 TARGETS ${library_target} ${protos_target}
269- ${backwards_compat_proto_targets}
285+ ${backwards_compat_proto_targets} ${transition_target}
270286 EXPORT ${library_target} -targets
271287 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
272288 COMPONENT google_cloud_cpp_runtime
@@ -296,14 +312,6 @@ function (google_cloud_cpp_add_gapic_library library display_name)
296312 endforeach ()
297313 string (JOIN "\n " GOOGLE_CLOUD_CPP_ADDITIONAL_FIND_DEPENDENCIES
298314 ${find_dependencies} )
299- if (_opt_TRANSITION)
300- set (cmake_config_transition_lines
301- "if (NOT TARGET ${experimental_alias} )"
302- " add_library(${experimental_alias} ALIAS ${library_alias} )"
303- "endif ()" )
304- string (JOIN "\n " GOOGLE_CLOUD_CPP_CONFIG_TRANSITION_TARGETS
305- ${cmake_config_transition_lines} )
306- endif ()
307315 configure_file ("${PROJECT_SOURCE_DIR} /cmake/templates/config.cmake.in"
308316 "${library_target} -config.cmake" @ONLY)
309317 write_basic_package_version_file(
0 commit comments