Skip to content

Problem with linking GPRT libraries with XDG in CMakeLists.txt #136

Description

@Waqar-ukaea

When attempting to link gprt to xdg in the CMakeLists.txt, I was encountering a CMake error to do with GPRT not exporting install targets:

CMake Error: install(EXPORT "xdg-targets" ...) includes target "xdg" which requires target "gprt" that is not in any export set.
-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

This error would be thrown but CMake would still generate the Makefile and XDG could be compiled as normal with tests passing and installation still seemingly working.

As a work around for this CMake error I have changed the following line in the CMakeLists.txt:
target_link_libraries(xdg gprt)
to:
target_link_libraries(xdg $<BUILD_INTERFACE:gprt>)
This ensures linking only happens at build time and not installation time. This is more of a workaround than a real fix and I am unsure if we will need GPRT to be linked at installation time as well as build time.

Originally posted by @Waqar-ukaea in https://github.com/pshriwise/xdg/issues/94#issuecomment-2796476896

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions