@@ -153,16 +153,24 @@ endfunction ()
153153function (google_cloud_cpp_add_ga_grpc_library library display_name )
154154 cmake_parse_arguments (
155155 _opt
156- "EXPERIMENTAL"
156+ "EXPERIMENTAL;TRANSITION "
157157 ""
158158 "ADDITIONAL_PROTO_LISTS;BACKWARDS_COMPAT_PROTO_TARGETS;CROSS_LIB_DEPS;SHARED_PROTO_DEPS"
159159 ${ARGN} )
160+ if (_opt_EXPERIMENTAL AND _opt_TRANSITION)
161+ message (
162+ FATAL_ERROR
163+ "EXPERIMENTAL and TRANSITION keywords are mutually exclusive. Only supply one."
164+ )
165+ endif ()
166+
160167 set (library_target "google_cloud_cpp_${library} " )
161168 set (mocks_target "google_cloud_cpp_${library} _mocks" )
162169 set (protos_target "google_cloud_cpp_${library} _protos" )
163170 set (library_alias "google-cloud-cpp::${library} " )
171+ set (experimental_alias "google-cloud-cpp::experimental-${library} " )
164172 if (_opt_EXPERIMENTAL)
165- set (library_alias "google-cloud-cpp::experimental- ${library } " )
173+ set (library_alias "${experimental_alias } " )
166174 endif ()
167175
168176 include (GoogleapisConfig )
@@ -323,6 +331,14 @@ function (google_cloud_cpp_add_ga_grpc_library library display_name)
323331 endforeach ()
324332 string (JOIN "\n " GOOGLE_CLOUD_CPP_ADDITIONAL_FIND_DEPENDENCIES
325333 ${find_dependencies} )
334+ if (_opt_TRANSITION)
335+ set (cmake_config_transition_lines
336+ "if (NOT TARGET ${experimental_alias} )"
337+ " add_library(${experimental_alias} ALIAS ${library_alias} )"
338+ "endif ()" )
339+ string (JOIN "\n " GOOGLE_CLOUD_CPP_CONFIG_TRANSITION_TARGETS
340+ ${cmake_config_transition_lines} )
341+ endif ()
326342 configure_file ("${PROJECT_SOURCE_DIR} /cmake/templates/config.cmake.in"
327343 "${library_target} -config.cmake" @ONLY )
328344 write_basic_package_version_file (
0 commit comments