Fix issue #9395 - only return true for .exe files on Windows from the is_file_executable function. Makes behavior of this function conceptually consistent with Mac and Linux behavior. Thanks to Clinton Stimpson for the patch.

This commit is contained in:
David Cole 2009-09-28 17:35:40 -04:00
parent 65a78ec5b8
commit b5265c2475
1 changed files with 4 additions and 4 deletions

View File

@ -73,16 +73,16 @@ function(is_file_executable file result_var)
get_filename_component(file_full "${file}" ABSOLUTE) get_filename_component(file_full "${file}" ABSOLUTE)
string(TOLOWER "${file_full}" file_full_lower) string(TOLOWER "${file_full}" file_full_lower)
# If file name ends in .exe or .dll on Windows, *assume* executable: # If file name ends in .exe on Windows, *assume* executable:
# #
if(WIN32) if(WIN32)
if("${file_full_lower}" MATCHES "\\.(exe|dll)$") if("${file_full_lower}" MATCHES "\\.exe$")
set(${result_var} 1 PARENT_SCOPE) set(${result_var} 1 PARENT_SCOPE)
return() return()
endif("${file_full_lower}" MATCHES "\\.(exe|dll)$") endif("${file_full_lower}" MATCHES "\\.exe$")
# A clause could be added here that uses output or return value of dumpbin # A clause could be added here that uses output or return value of dumpbin
# to determine ${result_var}. In 99%+? practical cases, the exe|dll name # to determine ${result_var}. In 99%+? practical cases, the exe name
# match will be sufficient... # match will be sufficient...
# #
endif(WIN32) endif(WIN32)