Explorar o código

GetPrerequisites.cmake: detect executables built with the -pie linker flag.

Clinton Stimpson %!s(int64=13) %!d(string=hai) anos
pai
achega
ac7a193951
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      Modules/GetPrerequisites.cmake

+ 8 - 0
Modules/GetPrerequisites.cmake

@@ -195,6 +195,14 @@ function(is_file_executable file result_var)
           return()
         endif("${file_ov}" MATCHES "text")
       endif("${file_ov}" MATCHES "executable")
+
+      # Also detect position independent executables on Linux,
+      # where "file" gives "shared object ... (uses shared libraries)"
+      if("${file_ov}" MATCHES "shared object.*\(uses shared libs\)")
+        set(${result_var} 1 PARENT_SCOPE)
+        return()
+      endif()
+
     else(file_cmd)
       message(STATUS "warning: No 'file' command, skipping execute_process...")
     endif(file_cmd)