GitHub user kou added a comment to the discussion: Why do pkgconfig files exist 
without corresponding CMake modules?

I didn't imagine Meson use case when I created it...

In CMake, we can use the following to check CSV availability:

```cmake
find_package(Arrow REQUIRED)
if(NOT ARROW_CSV)
  message(FATAL_ERROR "CSV must be enabled")
endif()
```

See also how Apache Arrow C GLib does: 
https://github.com/apache/arrow/blob/5a480444da35fa26bc6952755510ad39df9f7002/c_glib/meson.build#L101-L142

If we want to provide the same interface for pkg-config and CMake package, I 
suggest that we add variables to `arrow.pc` something like the following:

```diff
diff --git a/cpp/src/arrow/arrow.pc.in b/cpp/src/arrow/arrow.pc.in
index 309789379a..27d2899ccd 100644
--- a/cpp/src/arrow/arrow.pc.in
+++ b/cpp/src/arrow/arrow.pc.in
@@ -23,6 +23,8 @@ so_version=@ARROW_SO_VERSION@
 abi_version=@ARROW_SO_VERSION@
 full_so_version=@ARROW_FULL_SO_VERSION@
 
+csv=@ARROW_CSV@
+
 Name: Apache Arrow
 Description: Arrow is a set of technologies that enable big-data systems to 
process and move data fast.
 Version: @ARROW_VERSION@
```

With the approach, we can use the following Meson configuration:

```meson
assert(
    arrow.get_variable(cmake: 'ARROW_CSV', pkgconfig: 'csv', default_value: 
'OFF') == 'ON',
    'CSV module must be enabled',
)
```

In pkg-config context, `pkgconf --exists arrow-csv` is easier use than `[ 
"$(pkgconf --variable csv arrow)" = "ON" ]`. So we should not remove 
`arrow-csv` with the approach. The approach is just for CMake package 
compatibility.

GitHub link: 
https://github.com/apache/arrow/discussions/48158#discussioncomment-15005600

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to