Skip to content

Conversation

amazingakai
Copy link

@amazingakai amazingakai commented Aug 4, 2025

Updates the build setup to respect the BUILD_SHARED_LIBS flag when building libappimage.

  • If BUILD_SHARED_LIBS is On, builds a shared lib and links to xdg-basedir
  • If Off, builds a static lib and embeds xdg-basedir object files directly

Also removes the hardcoded libappimage_static target.

Defaults to shared build.

  • Added privately linked dependencies to cmake/imported_dependencies.cmake used when building statically.

@amazingakai amazingakai force-pushed the work/amazingakai/build-shared-or-static branch from 6b49091 to 782bc0b Compare August 11, 2025 13:29
@TheAssassin
Copy link
Member

Your comment makes it sound like this was, I don't know, a standard option or something that already existed but had a bug or similar. What's the motivation for this addition? It clearly adds some complexity, so I feel there needs to be some justification.

@amazingakai
Copy link
Author

Your comment makes it sound like this was, I don't know, a standard option or something that already existed but had a bug or similar. What's the motivation for this addition? It clearly adds some complexity, so I feel there needs to be some justification.

Currently libappimage is always built as a SHARED library, and libappimage_static is neither installed nor exported as a proper STATIC target (please correct me if I'm wrong here), so there is no way to link to it directly. By default both static and shared variants are built, which most users don't need and which adds unnecessary overhead. The two target setup (libappimage/libappimage_static) is also non-standard and adds extra work for downstream users.

I needed a static build and had no straightforward way to get it without custom CMake logic to decide which target to link to based on the environment. This change replaces the two-target setup with the standard BUILD_SHARED_LIBS option, so consumers can choose static or shared builds from the same target without extra hacks.

@amazingakai amazingakai force-pushed the work/amazingakai/build-shared-or-static branch 2 times, most recently from 9bedc20 to ba6c2ed Compare August 12, 2025 17:07
@amazingakai amazingakai force-pushed the work/amazingakai/build-shared-or-static branch from ba6c2ed to 690d85a Compare August 14, 2025 15:13
@amazingakai
Copy link
Author

ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants