Skip to content

Conversation

@marekdaniluk
Copy link
Contributor

Context

Currently, using add_subdirectory or FetchContent in a CMake project fails to compile. The compiler reports missing headers from the inkcpp_shared library. A workaround is to explicitly link it:

target_link_libraries(inkcpp_sample PRIVATE inkcpp inkcpp_compiler inkcpp_shared)

However, this is only a quick fix.

Problem

inkcpp_shared is a header-only library defined as an INTERFACE target and is used in the public headers of the inkcpp and inkcpp_compiler projects. However, both projects link inkcpp_shared as a PRIVATE dependency, which prevents its headers from being propagated to consumers.
This issue is not visible when inkcpp is installed, because the public headers from inkcpp_shared are copied during installation.

Solution

To fix the problem, inkcpp_shared should be linked PUBLIC so that its headers are properly propagated as part of the public API of both inkcpp and inkcpp_compiler.

Currently, using add_subdirectory or FetchContent requires linking inkcpp_shared to inkcpp_compiler to avoid missing headers (e.g., config.h). This is counterintuitive, because the installed library does not require this target, and it breaks the simple find_package(inkcpp) workflow.
@JBenda
Copy link
Owner

JBenda commented Jan 3, 2026

Thanks for the PR, got spotted

@JBenda JBenda merged commit 0327124 into JBenda:master Jan 3, 2026
7 of 8 checks passed
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