This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 59695076 build(c): replace usage of include_directories (#1133)
59695076 is described below

commit 596950766bed50213e8743e35afe9d632a41118a
Author: William Ayd <[email protected]>
AuthorDate: Fri Sep 29 12:13:47 2023 -0400

    build(c): replace usage of include_directories (#1133)
---
 c/driver/flightsql/CMakeLists.txt   | 18 +++++++++++++-----
 c/driver/snowflake/CMakeLists.txt   | 21 +++++++++++++++------
 c/driver/sqlite/CMakeLists.txt      | 17 ++++++++++++-----
 c/integration/duckdb/CMakeLists.txt |  9 ++++-----
 4 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/c/driver/flightsql/CMakeLists.txt 
b/c/driver/flightsql/CMakeLists.txt
index b20a3e71..a67df3a4 100644
--- a/c/driver/flightsql/CMakeLists.txt
+++ b/c/driver/flightsql/CMakeLists.txt
@@ -29,12 +29,16 @@ add_go_lib("${REPOSITORY_ROOT}/go/adbc/pkg/flightsql/"
            PKG_CONFIG_NAME
            adbc-driver-flightsql
            SHARED_LINK_FLAGS
-           ${LDFLAGS})
+           ${LDFLAGS}
+           OUTPUTS
+           ADBC_LIBRARIES)
 
-include_directories(SYSTEM ${REPOSITORY_ROOT})
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/driver)
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor)
+foreach(LIB_TARGET ${ADBC_LIBRARIES})
+  target_include_directories(${LIB_TARGET} SYSTEM
+                             INTERFACE ${REPOSITORY_ROOT} ${REPOSITORY_ROOT}/c/
+                                       ${REPOSITORY_ROOT}/c/vendor
+                                       ${REPOSITORY_ROOT}/c/driver)
+endforeach()
 
 if(ADBC_TEST_LINKAGE STREQUAL "shared")
   set(TEST_LINK_LIBS adbc_driver_flightsql_shared)
@@ -57,5 +61,9 @@ if(ADBC_BUILD_TESTS)
                 nanoarrow
                 ${TEST_LINK_LIBS})
   target_compile_features(adbc-driver-flightsql-test PRIVATE cxx_std_17)
+  target_include_directories(adbc-driver-flightsql-test SYSTEM
+                             PRIVATE ${REPOSITORY_ROOT} ${REPOSITORY_ROOT}/c/
+                                     ${REPOSITORY_ROOT}/c/vendor
+                                     ${REPOSITORY_ROOT}/c/driver)
   adbc_configure_target(adbc-driver-flightsql-test)
 endif()
diff --git a/c/driver/snowflake/CMakeLists.txt 
b/c/driver/snowflake/CMakeLists.txt
index ca6c121e..3f05dfa0 100644
--- a/c/driver/snowflake/CMakeLists.txt
+++ b/c/driver/snowflake/CMakeLists.txt
@@ -29,12 +29,16 @@ add_go_lib("${REPOSITORY_ROOT}/go/adbc/pkg/snowflake/"
            PKG_CONFIG_NAME
            adbc-driver-snowflake
            SHARED_LINK_FLAGS
-           ${LDFLAGS})
+           ${LDFLAGS}
+           OUTPUTS
+           ADBC_LIBRARIES)
 
-include_directories(SYSTEM ${REPOSITORY_ROOT})
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/driver)
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor)
+foreach(LIB_TARGET ${ADBC_LIBRARIES})
+  target_include_directories(${LIB_TARGET} SYSTEM
+                             INTERFACE ${REPOSITORY_ROOT} ${REPOSITORY_ROOT}/c/
+                                       ${REPOSITORY_ROOT}/c/vendor
+                                       ${REPOSITORY_ROOT}/c/driver)
+endforeach()
 
 if(ADBC_TEST_LINKAGE STREQUAL "shared")
   set(TEST_LINK_LIBS adbc_driver_snowflake_shared)
@@ -43,7 +47,6 @@ else()
 endif()
 
 if(ADBC_BUILD_TESTS)
-  include_directories(SYSTEM ${REPOSITORY_ROOT}/c/driver/common)
   add_test_case(driver_snowflake_test
                 PREFIX
                 adbc
@@ -57,5 +60,11 @@ if(ADBC_BUILD_TESTS)
                 nanoarrow
                 ${TEST_LINK_LIBS})
   target_compile_features(adbc-driver-snowflake-test PRIVATE cxx_std_17)
+  target_include_directories(adbc-driver-snowflake-test SYSTEM
+                             PRIVATE ${REPOSITORY_ROOT}
+                                     ${REPOSITORY_ROOT}/c/
+                                     ${REPOSITORY_ROOT}/c/vendor
+                                     ${REPOSITORY_ROOT}/c/driver
+                                     ${REPOSITORY_ROOT}/c/driver/common)
   adbc_configure_target(adbc-driver-snowflake-test)
 endif()
diff --git a/c/driver/sqlite/CMakeLists.txt b/c/driver/sqlite/CMakeLists.txt
index 3914ee8e..1f2c9f6d 100644
--- a/c/driver/sqlite/CMakeLists.txt
+++ b/c/driver/sqlite/CMakeLists.txt
@@ -46,14 +46,15 @@ add_arrow_lib(adbc_driver_sqlite
               adbc_driver_common
               nanoarrow
               ${LIBPQ_STATIC_LIBRARIES})
-include_directories(SYSTEM ${REPOSITORY_ROOT})
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor)
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/driver)
-include_directories(SYSTEM ${SQLite3_INCLUDE_DIRS})
 
 foreach(LIB_TARGET ${ADBC_LIBRARIES})
   target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING)
+  target_include_directories(${LIB_TARGET} SYSTEM
+                             PRIVATE ${REPOSITORY_ROOT}
+                                     ${REPOSITORY_ROOT}/c/
+                                     ${SQLite3_INCLUDE_DIRS}
+                                     ${REPOSITORY_ROOT}/c/vendor
+                                     ${REPOSITORY_ROOT}/c/driver)
 endforeach()
 
 include(CheckTypeSize)
@@ -80,5 +81,11 @@ if(ADBC_BUILD_TESTS)
                 nanoarrow
                 ${TEST_LINK_LIBS})
   target_compile_features(adbc-driver-sqlite-test PRIVATE cxx_std_17)
+  target_include_directories(adbc-driver-sqlite-test SYSTEM
+                             PRIVATE ${REPOSITORY_ROOT}
+                                     ${REPOSITORY_ROOT}/c/
+                                     ${LIBPQ_INCLUDE_DIRS}
+                                     ${REPOSITORY_ROOT}/c/vendor
+                                     ${REPOSITORY_ROOT}/c/driver)
   adbc_configure_target(adbc-driver-sqlite-test)
 endif()
diff --git a/c/integration/duckdb/CMakeLists.txt 
b/c/integration/duckdb/CMakeLists.txt
index 8053713f..8e4acbed 100644
--- a/c/integration/duckdb/CMakeLists.txt
+++ b/c/integration/duckdb/CMakeLists.txt
@@ -52,11 +52,6 @@ if(ADBC_BUILD_TESTS)
   message(STATUS "Fetching DuckDB")
   fetchcontent_makeavailable(duckdb)
 
-  include_directories(SYSTEM ${REPOSITORY_ROOT})
-  include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
-  include_directories(PRIVATE ${REPOSITORY_ROOT}/c/driver)
-  include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor)
-
   add_test_case(integration_duckdb_test
                 PREFIX
                 adbc
@@ -72,5 +67,9 @@ if(ADBC_BUILD_TESTS)
                 nanoarrow)
   add_dependencies(adbc-integration-duckdb-test duckdb)
   target_compile_features(adbc-integration-duckdb-test PRIVATE cxx_std_17)
+  target_include_directories(adbc-integration-duckdb-test SYSTEM
+                             PRIVATE ${REPOSITORY_ROOT} ${REPOSITORY_ROOT}/c/
+                                     ${REPOSITORY_ROOT}/c/vendor
+                                     ${REPOSITORY_ROOT}/c/driver)
   adbc_configure_target(adbc-integration-duckdb-test)
 endif()

Reply via email to