Skip to content

Build both static and shared version of libgerbv at the same time#425

Merged
spe-ciellt merged 1 commit intodevelopfrom
feat/build-both-shared-and-static-libraries-at-the-same-time
Mar 10, 2026
Merged

Build both static and shared version of libgerbv at the same time#425
spe-ciellt merged 1 commit intodevelopfrom
feat/build-both-shared-and-static-libraries-at-the-same-time

Conversation

@spe-ciellt
Copy link
Copy Markdown
Contributor

@spe-ciellt spe-ciellt commented Mar 10, 2026

By creating a default library as an INTERFACE target and then make two different (STATIC and SHARED) targets that links to the INTERFACE target we can get both libraries at the same time.

By using an INTERFACE target we don't have to set target_sources() and other things twice, we simply reuse the INTERFACE target for both. INTERFACE targets doesn't compile, it just carries the information over. The respective SHARED and STATIC target does the compilation with the information from the INTERFACE target.

The only caveat so far seems to be that the dxflib_bundled (which is an OBJECT library) needs to be set as a linked library in both STATIC and SHARED. It is not "carried over" from the INTERFACE library.

Improved over #417

Checked that both .deb and .rpm contains both libgerbv.a and libgerbv.so*, and the application is linked against the shared library.

Closes #416

By creating a default library as an INTERFACE target and then make
two different (STATIC and SHARED) targets that links to the INTERFACE
target we can get both libraries at the same time.

By using an INTERFACE target we don't have to set target_sources() and
other things twice, we simply reuse the INTERFACE target for both.
INTERFACE targets doesn't compile, it just carries the information over.
The respective SHARED and STATIC target does the compilation with the
information from the INTERFACE target.

The only caveat so far seems to be that the dxflib_bundles (which is
an OBJECT library) needs to be set as a linked library in both STATIC
and SHARED. It is not "carried over" from the INTERFACE library.
@spe-ciellt spe-ciellt self-assigned this Mar 10, 2026
@spe-ciellt spe-ciellt added enhancement New feature or request buildsystem Updates to the buildsystem (CMake/CTest/CPack) labels Mar 10, 2026
@spe-ciellt spe-ciellt merged commit 0e3cd01 into develop Mar 10, 2026
8 checks passed
@spe-ciellt spe-ciellt deleted the feat/build-both-shared-and-static-libraries-at-the-same-time branch March 11, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buildsystem Updates to the buildsystem (CMake/CTest/CPack) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V2.12.0 build doesn't create .so files. Older v2.11.1 build does create the .so files

1 participant