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

Declare single library in CMake

Open chfast opened this issue 5 years ago • 2 comments

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.

chfast avatar Jun 21 '20 14:06 chfast

So why did this get stuck?

mibli avatar May 16 '22 12:05 mibli

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.

jktjkt avatar Feb 02 '23 20:02 jktjkt