Skip to content

Only install library and headers when libshared is built standalone - #123

Open
lauft wants to merge 1 commit into
masterfrom
issue/122-install-guard
Open

lauft wants to merge 1 commit into
masterfrom
issue/122-install-guard

Conversation

@lauft

@lauft lauft commented Sep 23, 2026

Copy link
Copy Markdown
Member

install() rules are cumulative across a CMake project, so projects that include libshared via add_subdirectory() (e.g. Timewarrior since GothenburgBitFactory/timewarrior#706) inherit the rules installing lib/libshared.a and all headers to include/, polluting the embedding project's install manifest.

Guard the install rules with LIBSHARED_IS_TOP_LEVEL, which is set when libshared is the top-level project, so they only apply to standalone builds.

Closes #122

install() rules are cumulative across a CMake project, so projects that
include libshared via add_subdirectory() (e.g. Timewarrior since
GothenburgBitFactory/timewarrior#706) inherit the rules installing
lib/libshared.a and all headers to include/, polluting the embedding
project's install manifest.

Guard the install rules with LIBSHARED_IS_TOP_LEVEL, which is set when
libshared is the top-level project, so they only apply to standalone
builds.

Closes #122

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
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.

Unnecessary files from libshared are installed when used as submodule

1 participant