Skip to content

CMake package config does not reference include directory #23

Description

@SamVanheer

When using CMake's package config file to add the library to a project using find_package the include directory is not referenced, making it impossible to include mstch.hpp in your own project.

To fix this, modify src/CMakeLists.txt from this:

install(
    TARGETS mstch EXPORT mstchTargets
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib)

To this:

install(
    TARGETS mstch EXPORT mstchTargets
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
    INCLUDES DESTINATION include)

This tells CMake to set the INTERFACE_INCLUDE_DIRECTORIES property on the target to ${CMAKE_INSTALL_PREFIX}/include, allowing you to #include <mstch/mstch.hpp>.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions