is_file_executable() from GetPrerequisites.cmake erroneously returns 0 for DLL on windows
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
On Windows is_file_executable()
checks the extension to determine whether the file is executable. DLL should also be considered as executable, so fixup_bundle
would work.
> cmake -P is_dll_executable.cmake
c:/windows/system32/kernel32.dll: 0
> type is_dll_executable.cmake
include(BundleUtilities)
set(f0 "c:/windows/system32/kernel32.dll")
is_file_executable(f0 is_dll_executable)
message("${f0}: ${is_dll_executable}")
expected output would be:
c:/windows/system32/kernel32.dll: 1
diff --git a/GetPrerequisites.cmake-orig b/GetPrerequisites.cmake
index 8f2754e..94ae7d1 100644
--- a/GetPrerequisites.cmake-orig
+++ b/GetPrerequisites.cmake
@@ -144,10 +144,10 @@ function(is_file_executable file result_var)
get_filename_component(file_full "${file}" ABSOLUTE)
string(TOLOWER "${file_full}" file_full_lower)
- # If file name ends in .exe on Windows, *assume* executable:
+ # If file name ends in .exe or .dll on Windows, *assume* executable:
#
if(WIN32 AND NOT UNIX)
- if("${file_full_lower}" MATCHES "\\.exe$")
+ if("${file_full_lower}" MATCHES "\\.exe$" OR "${file_full_lower}" MATCHES "\\.dll$")
set(${result_var} 1 PARENT_SCOPE)
return()
endif()