Browse Source

cmComputeLinkInformation: Better RPATH detection for versioned libraries.

Some libraries uses the non-conventional SONAME scheme like
`libssl.so.1.1` or `libboost_system.so.1.64.0`, but CMake didn't count on
such versioned libraries. This commit modify regular expressions to match
relaxed format of shared library name for determining various linker options,
especially `RPATH`.
Note that support for one component has been available since v2.8.12.

Fixes: #15938
Byoungchan Lee 8 years ago
parent
commit
5cbf3653ff
1 changed files with 3 additions and 5 deletions
  1. 3 5
      Source/cmComputeLinkInformation.cxx

+ 3 - 5
Source/cmComputeLinkInformation.cxx

@@ -913,11 +913,9 @@ std::string cmComputeLinkInformation::CreateExtensionRegex(
   // Finish the list.
   libext += ")";
 
-  // Add an optional OpenBSD version component.
-  if (this->OpenBSD) {
-    libext += "(\\.[0-9]+\\.[0-9]+)?";
-  } else if (type == LinkShared) {
-    libext += "(\\.[0-9]+)?";
+  // Add an optional OpenBSD-style version or major.minor.version component.
+  if (this->OpenBSD || type == LinkShared) {
+    libext += "(\\.[0-9]+)*";
   }
 
   libext += "$";