Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: interface proto libraries work with older CMake #10636

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmake/CompileProtos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ include(GNUInstallDirs)

# Install headers for a C++ proto library.
function (google_cloud_cpp_install_proto_library_headers target)
get_target_property(type ${target} TYPE)
if ("${type}" STREQUAL "INTERFACE_LIBRARY")
return()
endif ()
get_target_property(target_sources ${target} SOURCES)
foreach (header ${target_sources})
# Skip anything that is not a header file.
Expand All @@ -332,6 +336,10 @@ endfunction ()

# Install protos for a C++ proto library.
function (google_cloud_cpp_install_proto_library_protos target source_dir)
get_target_property(type ${target} TYPE)
if ("${type}" STREQUAL "INTERFACE_LIBRARY")
return()
endif ()
get_target_property(target_protos ${target} PROTO_SOURCES)
foreach (header ${target_protos})
# Skip anything that is not a header file.
Expand Down
7 changes: 6 additions & 1 deletion google/cloud/dialogflow_es/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ endif ()

include(CompileProtos)
add_library(google_cloud_cpp_dialogflow_es_protos INTERFACE)
external_googleapis_set_version_and_alias(dialogflow_es_protos)
set_target_properties(
google_cloud_cpp_dialogflow_es_protos
PROPERTIES EXPORT_NAME google-cloud-cpp::dialogflow_es_protos)
add_library(google-cloud-cpp::dialogflow_es_protos ALIAS
google_cloud_cpp_dialogflow_es_protos)

target_link_libraries(
google_cloud_cpp_dialogflow_es_protos
PUBLIC
Expand Down
7 changes: 2 additions & 5 deletions google/cloud/speech/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ endif ()
add_library(google_cloud_cpp_speech_protos INTERFACE)
target_link_libraries(google_cloud_cpp_speech_protos
INTERFACE google-cloud-cpp::cloud_speech_protos)
set_target_properties(
google_cloud_cpp_speech_protos
PROPERTIES EXPORT_NAME google-cloud-cpp::speech_protos
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}")
set_target_properties(google_cloud_cpp_speech_protos
PROPERTIES EXPORT_NAME google-cloud-cpp::speech_protos)
target_compile_options(google_cloud_cpp_speech_protos
INTERFACE ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
add_library(google-cloud-cpp::speech_protos ALIAS
Expand Down
4 changes: 1 addition & 3 deletions google/cloud/texttospeech/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ target_link_libraries(google_cloud_cpp_texttospeech_protos
INTERFACE google-cloud-cpp::cloud_texttospeech_protos)
set_target_properties(
google_cloud_cpp_texttospeech_protos
PROPERTIES EXPORT_NAME google-cloud-cpp::texttospeech_protos
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}")
PROPERTIES EXPORT_NAME google-cloud-cpp::texttospeech_protos)
target_compile_options(google_cloud_cpp_texttospeech_protos
INTERFACE ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
add_library(google-cloud-cpp::texttospeech_protos ALIAS
Expand Down
7 changes: 2 additions & 5 deletions google/cloud/trace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ target_link_libraries(
google_cloud_cpp_trace_protos
INTERFACE google-cloud-cpp::devtools_cloudtrace_v2_trace_protos
google-cloud-cpp::devtools_cloudtrace_v2_tracing_protos)
set_target_properties(
google_cloud_cpp_trace_protos
PROPERTIES EXPORT_NAME google-cloud-cpp::trace_protos
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}")
set_target_properties(google_cloud_cpp_trace_protos
PROPERTIES EXPORT_NAME google-cloud-cpp::trace_protos)
target_compile_options(google_cloud_cpp_trace_protos
INTERFACE ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
add_library(google-cloud-cpp::trace_protos ALIAS google_cloud_cpp_trace_protos)
Expand Down