From ac7fc6b2972815585e2e33f7deac2f769f4d13fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Fri, 15 Mar 2024 13:09:41 +0000 Subject: [PATCH] cleanup: Move install targets to CMake files under `export`. Since the install logic needs to install everything that is part of the public interface of the project, it is arguable best put in the CMake files of the `export` folder, which also contains the public code. This also removes the necessity to include the subdirectories under `src` in a particular order, which would otherwise exist due to the `install` command needing to see all installed targets. --- export/planloader/CMakeLists.txt | 17 +++++++++++++++-- src/substrait/CMakeLists.txt | 2 +- src/substrait/common/CMakeLists.txt | 18 ------------------ 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/export/planloader/CMakeLists.txt b/export/planloader/CMakeLists.txt index e33353a9..23d10ccc 100644 --- a/export/planloader/CMakeLists.txt +++ b/export/planloader/CMakeLists.txt @@ -7,8 +7,21 @@ target_link_libraries(planloader substrait_io) install( TARGETS planloader - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PRIVATE_HEADER DESTINATION ${CMAKE_INSTALL_INCDIR}) + 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) diff --git a/src/substrait/CMakeLists.txt b/src/substrait/CMakeLists.txt index 528a0af0..99adce61 100644 --- a/src/substrait/CMakeLists.txt +++ b/src/substrait/CMakeLists.txt @@ -18,9 +18,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY set(ADDITIONAL_CLEAN_FILES "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY};${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +add_subdirectory(common) add_subdirectory(type) add_subdirectory(expression) add_subdirectory(function) add_subdirectory(proto) add_subdirectory(textplan) -add_subdirectory(common) diff --git a/src/substrait/common/CMakeLists.txt b/src/substrait/common/CMakeLists.txt index c30f5e48..98ed7ab4 100644 --- a/src/substrait/common/CMakeLists.txt +++ b/src/substrait/common/CMakeLists.txt @@ -24,24 +24,6 @@ if(${SUBSTRAIT_CPP_BUILD_TESTING}) add_subdirectory(tests) endif() -install( - TARGETS 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 - DESTINATION ${CMAKE_INSTALL_LIBDIR} - EXPORT SubstraitTargets) -install(FILES ../../../include/substrait/common/Io.h - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/substrait/common") -install(EXPORT SubstraitTargets DESTINATION lib/cmake/Substrait) - add_executable(plantransformer PlanTransformerTool.cpp) target_link_libraries(plantransformer substrait_io)