docopt.cpp icon indicating copy to clipboard operation
docopt.cpp copied to clipboard

Add CMake imported target for docopt library

Open eaaltonen opened this issue 2 years ago • 2 comments

This PR writes the CMake config-file package using CMakePackageConfigHelpers and exports the target as a Docopt::docopt imported target.

This allows developers to install and use the library without necessarily requiring root permission by:

  1. Installing docopt with -DCMAKE_INSTALL_PREFIX="${HOME}/wherever"
  2. then using with -DCMAKE_PREFIX_PATH="${HOME}/wherever" and linking to imported target Docopt::docopt.

Keeping in mind the newly released FetchContent and find_package() integration, also add an alias target so that Docopt::docopt can be linked to regardless of whether the build uses a prebuilt package or fetches the sources.

eaaltonen avatar Oct 17 '22 11:10 eaaltonen

added missing newline to docopt-config.cmake.in.

eaaltonen avatar Oct 17 '22 11:10 eaaltonen

@jaredgrubb : if you could take a look? I will be submitting packaging to Buildroot soonish.

eaaltonen avatar Oct 18 '22 18:10 eaaltonen