From ac7a1939511eda6b2baa1211fa5dcd12ec241fae Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Thu, 5 Jul 2012 12:49:40 -0600 Subject: [PATCH] GetPrerequisites.cmake: detect executables built with the -pie linker flag. --- Modules/GetPrerequisites.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 8761f400f..d215685dd 100644 --- a/Modules/GetPrerequisites.cmake +++ b/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)