docopt / docopt.cpp

C++11 port of docopt
Boost Software License 1.0
1.04k stars 146 forks source link

Add CMake imported target for docopt library #159

Open eaaltonen opened 1 year ago

eaaltonen commented 1 year ago

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 commented 1 year ago

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

eaaltonen commented 1 year ago

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