From 8347198d7ea2d95c8bf8d156a8b97be5441d8059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Sat, 16 Mar 2024 06:17:59 +0000 Subject: [PATCH] fix: Preserve folder structure of installed proto header files. The mechanism using the `PUBLIC_HEADERS` properties does not seem to preserve the folder structure of the header files provided to it. Consequently, `extensions/extensions.pb.h` ended up on the same level as the other header files. This commit uses a different mechanism based on `FILE_SET`, which, however, is only available since CMake v2.23. --- src/substrait/proto/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/substrait/proto/CMakeLists.txt b/src/substrait/proto/CMakeLists.txt index 3adc873d..2b55fe3e 100644 --- a/src/substrait/proto/CMakeLists.txt +++ b/src/substrait/proto/CMakeLists.txt @@ -79,7 +79,9 @@ endforeach() # Add the generated protobuf C++ files to our exported library. add_library(substrait_proto ${PROTO_SRCS} ${PROTO_HDRS} ProtoUtils.cpp ProtoUtils.h) -set_target_properties(substrait_proto PROPERTIES PUBLIC_HEADER "${PROTO_HDRS}") +target_sources( + substrait_proto PUBLIC FILE_SET HEADERS BASE_DIRS + ${PROTO_OUTPUT_TOPLEVEL_DIR} FILES ${PROTO_HDRS}) # Include the protobuf library as a dependency to use this class. target_link_libraries(substrait_proto protobuf::libprotobuf) @@ -95,5 +97,5 @@ target_include_directories( install( TARGETS substrait_proto EXPORT SubstraitTargets - LIBRARY - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/substrait/proto") + LIBRARY FILE_SET HEADERS + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/substrait/proto")