Skip to content

Installed package does not compile for a consumer: tmech headers are neither installed nor exported #70

Description

@petlenz

With the default configuration (tmech fetched, NUMSIM_USE_SYSTEM_TMECH=OFF), cmake --install followed by a consumer doing

find_package(numsim-materials REQUIRED)
target_link_libraries(app PRIVATE numsim-materials::numsim-materials)

configures successfully and then fails to compile:

error: 'mandel' is not a member of 'tmech'

CMakeLists.txt:128-134 adds the fetched tmech include directory to the interface without linking the target, to keep it out of the export set. That directory is a build-tree path, so the installed package either points at nothing or picks up an older system tmech.

Fix (either)

  • install the fetched tmech headers alongside ours and add the installed path to the interface via $<INSTALL_INTERFACE:...>, or
  • require an installed tmech for an installable build and export the dependency, with a version check once tmech's config provides one.

Test

A CI job that installs to a scratch prefix and builds a one-file consumer against it.

All references are to main at 91bd26f.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions