diff --git a/export/planloader/CMakeLists.txt b/export/planloader/CMakeLists.txt index 23d10ccc..2d64b68f 100644 --- a/export/planloader/CMakeLists.txt +++ b/export/planloader/CMakeLists.txt @@ -5,24 +5,10 @@ add_library(planloader SHARED planloader.cpp) add_dependencies(planloader substrait_io) target_link_libraries(planloader substrait_io) -install( - TARGETS planloader - substrait_io - substrait_common - substrait_proto - substrait_textplan_converter - substrait_textplan_loader - substrait_base_proto_visitor - symbol_table - error_listener - substrait_type - substrait_expression - textplan_grammar - EXPORT SubstraitTargets) -install(FILES ../../include/substrait/common/Io.h - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/substrait/common") -install(EXPORT SubstraitTargets DESTINATION lib/cmake/Substrait) - if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) 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 98ed7ab4..b7e7dcd4 100644 --- a/src/substrait/common/CMakeLists.txt +++ b/src/substrait/common/CMakeLists.txt @@ -4,6 +4,9 @@ add_library(substrait_common Exceptions.cpp) 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) + add_dependencies( substrait_io substrait_proto @@ -27,3 +30,9 @@ endif() add_executable(plantransformer PlanTransformerTool.cpp) target_link_libraries(plantransformer substrait_io) + +install( + TARGETS substrait_common substrait_io + EXPORT SubstraitTargets + LIBRARY + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/substrait/common") diff --git a/src/substrait/expression/CMakeLists.txt b/src/substrait/expression/CMakeLists.txt index cdb1e7aa..768a9c76 100644 --- a/src/substrait/expression/CMakeLists.txt +++ b/src/substrait/expression/CMakeLists.txt @@ -8,3 +8,5 @@ target_link_libraries(substrait_expression substrait_proto absl::numeric if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() + +install(TARGETS substrait_expression EXPORT SubstraitTargets) diff --git a/src/substrait/function/CMakeLists.txt b/src/substrait/function/CMakeLists.txt index 218619a5..b67f89ad 100644 --- a/src/substrait/function/CMakeLists.txt +++ b/src/substrait/function/CMakeLists.txt @@ -9,3 +9,5 @@ target_link_libraries(substrait_function substrait_type yaml-cpp) if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() + +install(TARGETS substrait_function EXPORT SubstraitTargets) diff --git a/src/substrait/proto/CMakeLists.txt b/src/substrait/proto/CMakeLists.txt index a9adde5c..3adc873d 100644 --- a/src/substrait/proto/CMakeLists.txt +++ b/src/substrait/proto/CMakeLists.txt @@ -79,6 +79,7 @@ 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}") # Include the protobuf library as a dependency to use this class. target_link_libraries(substrait_proto protobuf::libprotobuf) @@ -90,3 +91,9 @@ target_include_directories( $ PUBLIC $ $) + +install( + TARGETS substrait_proto + EXPORT SubstraitTargets + LIBRARY + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/substrait/proto") diff --git a/src/substrait/textplan/CMakeLists.txt b/src/substrait/textplan/CMakeLists.txt index 8a23994e..a0237ff9 100644 --- a/src/substrait/textplan/CMakeLists.txt +++ b/src/substrait/textplan/CMakeLists.txt @@ -42,3 +42,6 @@ target_include_directories( if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() + +install(TARGETS error_listener parse_result symbol_table + EXPORT SubstraitTargets) diff --git a/src/substrait/textplan/converter/CMakeLists.txt b/src/substrait/textplan/converter/CMakeLists.txt index dc2cfe77..1f4b7808 100644 --- a/src/substrait/textplan/converter/CMakeLists.txt +++ b/src/substrait/textplan/converter/CMakeLists.txt @@ -53,3 +53,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) diff --git a/src/substrait/textplan/parser/CMakeLists.txt b/src/substrait/textplan/parser/CMakeLists.txt index 36e24027..7eceac33 100644 --- a/src/substrait/textplan/parser/CMakeLists.txt +++ b/src/substrait/textplan/parser/CMakeLists.txt @@ -43,3 +43,5 @@ target_link_libraries(planparser substrait_textplan_loader error_listener) if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() + +install(TARGETS substrait_textplan_loader EXPORT SubstraitTargets) diff --git a/src/substrait/textplan/parser/grammar/CMakeLists.txt b/src/substrait/textplan/parser/grammar/CMakeLists.txt index af75d9e6..df42f515 100644 --- a/src/substrait/textplan/parser/grammar/CMakeLists.txt +++ b/src/substrait/textplan/parser/grammar/CMakeLists.txt @@ -60,3 +60,5 @@ target_include_directories( PUBLIC $) target_link_libraries(textplan_grammar antlr4_static) + +install(TARGETS textplan_grammar EXPORT SubstraitTargets) diff --git a/src/substrait/type/CMakeLists.txt b/src/substrait/type/CMakeLists.txt index 4b473701..75c8eaec 100644 --- a/src/substrait/type/CMakeLists.txt +++ b/src/substrait/type/CMakeLists.txt @@ -9,3 +9,5 @@ target_link_libraries(substrait_type substrait_common) if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() + +install(TARGETS substrait_type EXPORT SubstraitTargets) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 9e2b5ca9..0a5f605b 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -1,5 +1,8 @@ # SPDX-License-Identifier: Apache-2.0 +# Ensure `option()` in subdirectories honors normal variables set here. +set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) + set(ABSL_ENABLE_INSTALL ON) if(NOT ${ABSL_INCLUDED_WITH_PROTOBUF}) set(ABSL_PROPAGATE_CXX_STD ON) @@ -27,6 +30,7 @@ set(BUILD_TESTING OFF) add_subdirectory(protobuf-matchers) set(BUILD_TESTING ${PREVIOUS_BUILD_TESTING}) +set(YAML_CPP_INSTALL ON) set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "Enable testing")