Skip to content

Commit

Permalink
fix: Preserve folder structure of installed proto header files.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ingomueller-net committed Mar 16, 2024
1 parent 4b3a564 commit 8347198
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/substrait/proto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")

0 comments on commit 8347198

Please sign in to comment.