docopt / docopt.cpp

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

Declare single library in CMake #134

Open chfast opened 4 years ago

chfast commented 4 years ago

Fixes #104

This replaces 2 libraries declared in CMake: docopt (SHARED) and docopt_s (STATIC) with single one docopt which can be built as static or shared depending on -DBUILD_SHARED_LIBS=ON/OFF.

mibli commented 2 years ago

So why did this get stuck?

jktjkt commented 1 year ago

Just FYI, various distros (at least Fedora and Arch) have policies which prevent installing static libraries. This is a problem because the resulting RPMs contain just the shared library, but the installed CMake target files attempt to reference the docopt_s target as well. It ends up like this:

CMake Error at /lib64/cmake/docopt/docopt-targets.cmake:90 (message):
  The imported target "docopt_s" references the file

     "/usr/lib64/libdocopt.a"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/lib64/cmake/docopt/docopt-targets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /lib64/cmake/docopt/docopt-config.cmake:1 (include)
  CMakeLists.txt:33 (find_package)

The easiest workaround is to give up on CMake files and just use pkg-config, of course.