3

I'm building two packages in a distribution:

  1. runtime shared library package
  2. dev libary package

The problem is to include a correct symlink into any of them. Currently I use:

set_target_properties(mylib PROPERTIES 
                        SOVERSION "${PROJECT_VERSION_MAJOR}"
                        VERSION "${PROJECT_VERSION}")

and when specifying the following CPack configuration:

install (TARGETS mylib
          LIBRARY
          DESTINATION /usr/lib
          COMPONENT runtime)

install (TARGETS mylib
          LIBRARY
          DESTINATION /usr/lib
          COMPONENT dev)

install (DIRECTORY include/
          DESTINATION /usr/include/mylib 
          COMPONENT dev)

the runtime shared library package then contains the following symlink chain:

/usr/lib/libmylib.so -> libmylib.so.0
/usr/lib/libmylib.so.0 -> libmylib.so.0.0.1
/usr/lib/libmylib.so.0.0.1

The problem is /usr/lib/libmylib.so -> libmylib.so.0 is redundant in the runtime shared library package since it is only necessary when building a binary that uses this libmylib.

Question: Is there a way to excelude that /usr/lib/libmylib.so -> libmylib.so.0 symlink from runtime shared library package?

starball
  • 20,030
  • 7
  • 43
  • 238
St.Antario
  • 26,175
  • 41
  • 130
  • 318

1 Answers1

1

You should be able to do this using the NAMELINK_SKIP parameter of the install(TARGETS) command.

NAMELINK_SKIP

Similar to NAMELINK_ONLY, but it has the opposite effect: it causes the installation of library files other than the namelink when a library target is installed. When neither NAMELINK_ONLY or NAMELINK_SKIP are given, both portions are installed. On platforms where versioned shared libraries do not have symlinks or when a library is not versioned, NAMELINK_SKIP installs the library. It is an error to use this parameter outside of a LIBRARY block.

If NAMELINK_SKIP is specified, NAMELINK_COMPONENT has no effect. It is not recommended to use NAMELINK_SKIP in conjunction with NAMELINK_COMPONENT.

starball
  • 20,030
  • 7
  • 43
  • 238