diff --git a/CMakeLists.txt b/CMakeLists.txt index 025d6c22..17185468 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,5 +63,7 @@ if(${SUBSTRAIT_CPP_BUILD_TESTING}) enable_testing() endif() +install(EXPORT SubstraitTargets DESTINATION lib/cmake/Substrait) + add_subdirectory(src/substrait) add_subdirectory(export) diff --git a/export/planloader/CMakeLists.txt b/export/planloader/CMakeLists.txt index 2d64b68f..e08e839c 100644 --- a/export/planloader/CMakeLists.txt +++ b/export/planloader/CMakeLists.txt @@ -10,5 +10,3 @@ if(${SUBSTRAIT_CPP_BUILD_TESTING}) endif() install(TARGETS planloader EXPORT SubstraitTargets) - -install(EXPORT SubstraitTargets DESTINATION lib/cmake/Substrait) diff --git a/src/substrait/common/CMakeLists.txt b/src/substrait/common/CMakeLists.txt index b7e7dcd4..70a1fc6a 100644 --- a/src/substrait/common/CMakeLists.txt +++ b/src/substrait/common/CMakeLists.txt @@ -1,11 +1,14 @@ # SPDX-License-Identifier: Apache-2.0 add_library(substrait_common Exceptions.cpp) +target_sources( + substrait_common PUBLIC FILE_SET HEADERS BASE_DIRS ../../../include/ FILES + ../../../include/substrait/common/Exceptions.h) target_link_libraries(substrait_common fmt::fmt-header-only) add_library(substrait_io STATIC Io.cpp) -set_target_properties( - substrait_io PROPERTIES PUBLIC_HEADER ../../../include/substrait/common/Io.h) +target_sources(substrait_io PUBLIC FILE_SET HEADERS BASE_DIRS ../../../include/ + FILES ../../../include/substrait/common/Io.h) add_dependencies( substrait_io @@ -32,7 +35,6 @@ add_executable(plantransformer PlanTransformerTool.cpp) target_link_libraries(plantransformer substrait_io) install( - TARGETS substrait_common substrait_io + TARGETS substrait_common substrait_io plantransformer EXPORT SubstraitTargets - LIBRARY - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/substrait/common") + LIBRARY FILE_SET HEADERS) diff --git a/src/substrait/expression/CMakeLists.txt b/src/substrait/expression/CMakeLists.txt index 768a9c76..9b1703b2 100644 --- a/src/substrait/expression/CMakeLists.txt +++ b/src/substrait/expression/CMakeLists.txt @@ -1,6 +1,10 @@ # SPDX-License-Identifier: Apache-2.0 add_library(substrait_expression DecimalLiteral.cpp) +target_sources( + substrait_expression + PUBLIC FILE_SET HEADERS BASE_DIRS ../../../include/ FILES + ../../../include/substrait/expression/DecimalLiteral.h) target_link_libraries(substrait_expression substrait_proto absl::numeric absl::strings) @@ -9,4 +13,7 @@ if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() -install(TARGETS substrait_expression EXPORT SubstraitTargets) +install( + TARGETS substrait_expression + EXPORT SubstraitTargets + FILE_SET HEADERS) diff --git a/src/substrait/function/CMakeLists.txt b/src/substrait/function/CMakeLists.txt index b67f89ad..352ff43e 100644 --- a/src/substrait/function/CMakeLists.txt +++ b/src/substrait/function/CMakeLists.txt @@ -3,6 +3,17 @@ set(FUNCTION_SRCS Function.cpp Extension.cpp FunctionLookup.cpp) add_library(substrait_function ${FUNCTION_SRCS}) +target_sources( + substrait_function + PUBLIC FILE_SET + HEADERS + BASE_DIRS + ../../../include/ + FILES + ../../../include/substrait/function/Extension.h + ../../../include/substrait/function/Function.h + ../../../include/substrait/function/FunctionLookup.h + ../../../include/substrait/function/FunctionSignature.h) target_link_libraries(substrait_function substrait_type yaml-cpp) @@ -10,4 +21,7 @@ if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() -install(TARGETS substrait_function EXPORT SubstraitTargets) +install( + TARGETS substrait_function + EXPORT SubstraitTargets + FILE_SET HEADERS) diff --git a/src/substrait/proto/CMakeLists.txt b/src/substrait/proto/CMakeLists.txt index 2b55fe3e..c6efa852 100644 --- a/src/substrait/proto/CMakeLists.txt +++ b/src/substrait/proto/CMakeLists.txt @@ -77,11 +77,17 @@ foreach(PROTO_FILE IN LISTS PROTOBUF_FILELIST) endforeach() # Add the generated protobuf C++ files to our exported library. -add_library(substrait_proto ${PROTO_SRCS} ${PROTO_HDRS} ProtoUtils.cpp - ProtoUtils.h) +add_library(substrait_proto ${PROTO_SRCS} ${PROTO_HDRS} ProtoUtils.cpp) target_sources( - substrait_proto PUBLIC FILE_SET HEADERS BASE_DIRS - ${PROTO_OUTPUT_TOPLEVEL_DIR} FILES ${PROTO_HDRS}) + substrait_proto + PUBLIC FILE_SET + HEADERS + BASE_DIRS + ${PROTO_OUTPUT_TOPLEVEL_DIR}/src + ../.. + FILES + ${PROTO_HDRS} + ProtoUtils.h) # Include the protobuf library as a dependency to use this class. target_link_libraries(substrait_proto protobuf::libprotobuf) @@ -97,5 +103,4 @@ target_include_directories( install( TARGETS substrait_proto EXPORT SubstraitTargets - LIBRARY FILE_SET HEADERS - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/substrait/proto") + LIBRARY FILE_SET HEADERS) diff --git a/src/substrait/textplan/converter/CMakeLists.txt b/src/substrait/textplan/converter/CMakeLists.txt index 1f4b7808..0dad7373 100644 --- a/src/substrait/textplan/converter/CMakeLists.txt +++ b/src/substrait/textplan/converter/CMakeLists.txt @@ -54,5 +54,6 @@ add_library(substrait_textplan_normalizer ${NORMALIZER_SRCS}) target_link_libraries(substrait_textplan_normalizer substrait_textplan_converter) -install(TARGETS substrait_textplan_converter substrait_base_proto_visitor - substrait_textplan_normalizer EXPORT SubstraitTargets) +install(TARGETS planconverter substrait_textplan_converter + substrait_base_proto_visitor substrait_textplan_normalizer + EXPORT SubstraitTargets) diff --git a/src/substrait/textplan/parser/CMakeLists.txt b/src/substrait/textplan/parser/CMakeLists.txt index 7eceac33..e593908e 100644 --- a/src/substrait/textplan/parser/CMakeLists.txt +++ b/src/substrait/textplan/parser/CMakeLists.txt @@ -44,4 +44,4 @@ if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() -install(TARGETS substrait_textplan_loader EXPORT SubstraitTargets) +install(TARGETS planparser substrait_textplan_loader EXPORT SubstraitTargets) diff --git a/src/substrait/type/CMakeLists.txt b/src/substrait/type/CMakeLists.txt index 75c8eaec..f43daaff 100644 --- a/src/substrait/type/CMakeLists.txt +++ b/src/substrait/type/CMakeLists.txt @@ -3,6 +3,9 @@ set(TYPE_SRCS Type.cpp) add_library(substrait_type ${TYPE_SRCS}) +target_sources( + substrait_type PUBLIC FILE_SET HEADERS BASE_DIRS ../../../include/ FILES + ../../../include/substrait/type/Type.h) target_link_libraries(substrait_type substrait_common) @@ -10,4 +13,7 @@ if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() -install(TARGETS substrait_type EXPORT SubstraitTargets) +install( + TARGETS substrait_type + EXPORT SubstraitTargets + FILE_SET HEADERS)