Skip to content

Avoid modifying alias targets in the installed CMake config - #192

Merged
HexDecimal merged 1 commit into
libtcod:mainfrom
snowyukitty:fix/cmake-package-alias-target
Oct 11, 2026
Merged

HexDecimal merged 1 commit into
libtcod:mainfrom
snowyukitty:fix/cmake-package-alias-target

Conversation

@snowyukitty

Copy link
Copy Markdown
Contributor

An existing libtcod::libtcod alias makes find_package(libtcod) fail because the installed config calls target_include_directories on that alias.

Remove the redundant include-directory mutation. The exported target already carries the install include paths. Keep LIBTCOD_INCLUDE_DIR, LIBTCOD_LIBRARY, dependency lookup, and required-component checking unchanged.

Add a downstream CMake consumer and a separate Linux CI job for static/shared packages. The tests relocate the installation before compiling, linking, and running a consumer; check that repeated find_package does not change include directories; and check that an existing alias is preserved. The package job disables optional SDL/zlib/PNG/Unicode dependencies to isolate the config/export behavior.

Validation on Linux (GCC 12, CMake 3.25):

  • Unmodified upstream reproduces the reported alias error. The new repeated-load check also fails on upstream and passes with the fix.
  • Both new CI command sequences pass locally, including the consumer runtime check.
  • Full portable suite: 78 cases passed, with all default optional features enabled; interface-header verification passed.
  • SDL3-enabled shared build with PNG/Unicode disabled: 59 cases and the relocated consumer passed.
  • Repository pre-commit hooks passed for all four changed files.

GUI-dependent tests tagged [!nonportable], Windows, and macOS were not run locally.

Fixes #191

@HexDecimal HexDecimal left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice to confirm that includes were already exported. Thanks also for confirming the error.

The job and tests are well written, though I might split up the workflow commands into more steps later.

@HexDecimal
HexDecimal merged commit a946a72 into libtcod:main Oct 11, 2026
26 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.

find_package fails on a locally installed libtcod

2 participants