[英]Create symlink using CPack
I'm building two packages in a distribution:我正在一个发行版中构建两个包:
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:并在指定以下
CPack
配置时:
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:运行时共享库 package 然后包含以下符号链接链:
/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
.问题是
/usr/lib/libmylib.so -> libmylib.so.0
在运行时共享库 package 中是多余的,因为只有在构建使用此libmylib
的二进制文件时才需要它。
Question: Is there a way to excelude that /usr/lib/libmylib.so -> libmylib.so.0
symlink from runtime shared library package?问题:有没有办法超越运行时共享库 package 中的
/usr/lib/libmylib.so -> libmylib.so.0
符号链接?
You should be able to do this using the NAMELINK_SKIP
parameter of the install(TARGETS)
command .您应该能够使用
install(TARGETS)
命令的NAMELINK_SKIP
参数来执行此操作。
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.类似于
NAMELINK_ONLY
,但它具有相反的效果:当安装库目标时,它会导致安装名称链接以外的库文件。 When neitherNAMELINK_ONLY
orNAMELINK_SKIP
are given, both portions are installed.当
NAMELINK_ONLY
或NAMELINK_SKIP
都没有给出时,这两个部分都被安装。 On platforms where versioned shared libraries do not have symlinks or when a library is not versioned,NAMELINK_SKIP
installs the library.在版本化共享库没有符号链接的平台上或库没有版本化时,
NAMELINK_SKIP
会安装该库。 It is an error to use this parameter outside of aLIBRARY
block.在
LIBRARY
块之外使用此参数是错误的。If
NAMELINK_SKIP
is specified,NAMELINK_COMPONENT
has no effect.如果指定了
NAMELINK_SKIP
,则NAMELINK_COMPONENT
无效。 It is not recommended to useNAMELINK_SKIP
in conjunction withNAMELINK_COMPONENT
.不建议将
NAMELINK_SKIP
与NAMELINK_COMPONENT
结合使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.