summaryrefslogtreecommitdiffstats
path: root/Modules/GetPrerequisites.cmake
diff options
context:
space:
mode:
authorPascal Thomet <pthomet@gmail.com>2016-12-22 11:28:26 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-11 15:48:36 (GMT)
commita7c5d5fb0e8d096dfc9b6e82e93f1e0d6225fe1f (patch)
tree604fffe371d75fc9a6b4ac99a4ecc6b7e76dbf00 /Modules/GetPrerequisites.cmake
parent65c18b2141fb2553911104e0c10fe74d8daf5b9d (diff)
downloadCMake-a7c5d5fb0e8d096dfc9b6e82e93f1e0d6225fe1f.zip
CMake-a7c5d5fb0e8d096dfc9b6e82e93f1e0d6225fe1f.tar.gz
CMake-a7c5d5fb0e8d096dfc9b6e82e93f1e0d6225fe1f.tar.bz2
GetPrerequisites: Exclude delay load dependencies on Windows
With some Windows toolchains we use `objdump` which does not mention delay load dependencies in its output. Therefore, to get consistent behavior we should always ignore them. Use the `dumpbin` message "Image has the following delay load dependencies" that precedes the delay load dependencies to recognize and skip them. Fortunately, this message is not translated to the current locale (at least on "Windows 7 French", "Windows 10 French" and "Windows Server 2008 R2 French"). Fixes: #16241
Diffstat (limited to 'Modules/GetPrerequisites.cmake')
-rw-r--r--Modules/GetPrerequisites.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 72775ce..d0cd5b9 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -810,6 +810,20 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
OUTPUT_VARIABLE gp_cmd_ov
ERROR_VARIABLE gp_ev
)
+
+ if(gp_tool STREQUAL "dumpbin")
+ # Exclude delay load dependencies under windows (they are listed in dumpbin output after the message below)
+ string(FIND "${gp_cmd_ov}" "Image has the following delay load dependencies" gp_delayload_pos)
+ if (${gp_delayload_pos} GREATER -1)
+ string(SUBSTRING "${gp_cmd_ov}" 0 ${gp_delayload_pos} gp_cmd_ov_no_delayload_deps)
+ string(SUBSTRING "${gp_cmd_ov}" ${gp_delayload_pos} -1 gp_cmd_ov_delayload_deps)
+ if (verbose)
+ message(STATUS "GetPrequisites(${target}) : ignoring the following delay load dependencies :\n ${gp_cmd_ov_delayload_deps}")
+ endif()
+ set(gp_cmd_ov ${gp_cmd_ov_no_delayload_deps})
+ endif()
+ endif()
+
if(NOT gp_rv STREQUAL "0")
if(gp_tool STREQUAL "dumpbin")
# dumpbin error messages seem to go to stdout