Hi,

Do you want a CMake target that can be used for shared
linking and static linking? For example, you want to use
Parquet::parquet for shared linking and static linking,
right?

In my understanding, we can't do it with CMake. We need to
specify "SHARED" or "STATIC" when create a CMake target by
add_library().
See also:
https://cmake.org/cmake/help/latest/command/add_library.html#normal

Thanks,
-- 
kou

In <cahgae5fhsb4wm9c6hprc5tyrlunb6e6-12hejwqxtqsti76...@mail.gmail.com>
  "[C++] Static/Shared Linkage in CMakeLists.txt" on Tue, 3 Jun 2025 13:45:36 
+0800,
  Eddie Chang <kalcifer7...@gmail.com> wrote:

> Hello everyone, I've noticed that in our CMakeLists.txt files, we have
> multiple instances where we conditionally select either the static or
> shared version of a linked target based on a cache variable such as
> ARROW_BUILD_SHARED. For example, the following pattern appears in several
> places:
> 
>     if(ARROW_BUILD_SHARED)
>         set(PARQUET_EXAMPLE_LINK_LIBS parquet_shared)
>     else()
>         set(PARQUET_EXAMPLE_LINK_LIBS parquet_static)
>     endif()
> 
> I’m wondering if there is a specific reason we don’t set the static/shared
> property of the libraries in a single location, and instead continue
> duplicating this kind of logic throughout the codebase?

Reply via email to