Opened 14 months ago

Closed 6 months ago

#878 closed patch (fixed)

Static library does not contain C API

Reported by: Dakota Hawkins Owned by: robe
Priority: major Milestone: 3.6.4
Component: Build/Install (cmake) Version: 3.6.2
Severity: Significant Keywords: cmake capi static
Cc:

Description

To support building (e.g., GDAL) against static libs only, add the C API to the static target.

Otherwise, if building with CMake, the C API is only available in a dynamic library.

In the future, this could be a lot cleaner -- e.g. with more idiomatic CMake configuration of shared vs. static builds -- but for the time being I hope this will be acceptable.

I have provided a 3.7 patch here and a 3.6 backport patch of the same thing here.

Applying that patch to 3.6.2 has allowed me to build a fully static version of GDAL using GEOS. Without it, GDAL would require the GEOS C API dynamic library.

I think (from reading the files) nmake will generate a similar static library, but I think its targets are slightly different from those generated by CMake, so I've just tried to use my best judgement for CMake.

Without this capability, we will be required to manually patch GEOS each time we pull a new version, and that will be difficult for us to maintain over time.

I would be happy to make any changes required or requested if it helps get this functionality into an official release.

Change History (3)

comment:1 Changed 12 months ago by robe

Milestone: 3.6.33.6.4
Owner: changed from mloskot to robe
Type: defectpatch

comment:2 Changed 11 months ago by Regina Obe <lr@…>

In 3f09f50/git:

Allow building C API as static lib for CMake. References #878 for GEOS 3.7.0, closes https://github.com/libgeos/geos/pull/102

comment:3 Changed 6 months ago by Paul Ramsey <pramsey@…>

Resolution: fixed
Status: newclosed

In 33abb84/git:

Static library does not contain C API
Closes #878

Note: See TracTickets for help on using tickets.