Merge topic 'cpack-deb-0-so-version-support'

5784ab8f CPack/Deb: handle shlibs file generation when SOVERSION set to 0

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1423
This commit is contained in:
Brad King 2017-10-30 12:55:34 +00:00 committed by Kitware Robot
commit 58e0692b62
4 changed files with 14 additions and 4 deletions

View File

@ -987,7 +987,7 @@ function(cpack_deb_prepare_package_vars)
if(READELF_EXECUTABLE)
foreach(_FILE IN LISTS CPACK_DEB_SHARED_OBJECT_FILES)
extract_so_info("${_FILE}" libname soversion)
if(libname AND soversion)
if(libname AND DEFINED soversion)
list(APPEND CPACK_DEBIAN_PACKAGE_SHLIBS_LIST
"${libname} ${soversion} ${CPACK_DEBIAN_PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY} ${CPACK_DEBIAN_PACKAGE_VERSION})")
else()

View File

@ -12,7 +12,7 @@ run_cpack_test(DIST "RPM" false "MONOLITHIC")
run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT")
run_cpack_test(VERSION "RPM;DEB" false "MONOLITHIC;COMPONENT")
run_cpack_test(EXTRA "DEB" false "COMPONENT")
run_cpack_test(GENERATE_SHLIBS "DEB" true "COMPONENT")
run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB" true "COMPONENT")
run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT")
run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT")
run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC")

View File

@ -1,4 +1,9 @@
set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$")
if(RunCMake_SUBTEST_SUFFIX STREQUAL "soversion_not_zero")
set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$")
else() # soversion_zero
set(shlibs_shlibs "^libtest_lib 0 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$")
endif()
# optional dot at the end of permissions regex is for SELinux enabled systems
set(shlibs_shlibs_permissions_regex "-rw-r--r--\.? .*")
verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs")

View File

@ -9,6 +9,11 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp"
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp"
"#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n")
add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp")
set_target_properties(test_lib PROPERTIES SOVERSION "0.8")
if(RunCMake_SUBTEST_SUFFIX STREQUAL "soversion_not_zero")
set_target_properties(test_lib PROPERTIES SOVERSION "0.8")
else() # soversion_zero
set_target_properties(test_lib PROPERTIES SOVERSION "0")
endif()
install(TARGETS test_lib DESTINATION foo COMPONENT libs)