mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 22:31:18 -05:00
GetPrerequisites: Allow prefixed tools
e.g. for cross-compilation with e.g. x86_64-pc-linux-gnu-ldd
This commit is contained in:
committed by
Craig Scott
parent
1bac4678ea
commit
52445300d6
@@ -718,25 +718,25 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
|
|||||||
|
|
||||||
set(gp_cmd_maybe_filter) # optional command to pre-filter gp_tool results
|
set(gp_cmd_maybe_filter) # optional command to pre-filter gp_tool results
|
||||||
|
|
||||||
if(gp_tool STREQUAL "ldd")
|
if(gp_tool MATCHES "ldd$")
|
||||||
set(gp_cmd_args "")
|
set(gp_cmd_args "")
|
||||||
set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$")
|
set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$")
|
||||||
set(gp_regex_error "not found${eol_char}$")
|
set(gp_regex_error "not found${eol_char}$")
|
||||||
set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$")
|
set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$")
|
||||||
set(gp_regex_cmp_count 1)
|
set(gp_regex_cmp_count 1)
|
||||||
elseif(gp_tool STREQUAL "otool")
|
elseif(gp_tool MATCHES "otool$")
|
||||||
set(gp_cmd_args "-L")
|
set(gp_cmd_args "-L")
|
||||||
set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
|
set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
|
||||||
set(gp_regex_error "")
|
set(gp_regex_error "")
|
||||||
set(gp_regex_fallback "")
|
set(gp_regex_fallback "")
|
||||||
set(gp_regex_cmp_count 3)
|
set(gp_regex_cmp_count 3)
|
||||||
elseif(gp_tool STREQUAL "dumpbin")
|
elseif(gp_tool MATCHES "dumpbin$")
|
||||||
set(gp_cmd_args "/dependents")
|
set(gp_cmd_args "/dependents")
|
||||||
set(gp_regex "^ ([^ ].*[Dd][Ll][Ll])${eol_char}$")
|
set(gp_regex "^ ([^ ].*[Dd][Ll][Ll])${eol_char}$")
|
||||||
set(gp_regex_error "")
|
set(gp_regex_error "")
|
||||||
set(gp_regex_fallback "")
|
set(gp_regex_fallback "")
|
||||||
set(gp_regex_cmp_count 1)
|
set(gp_regex_cmp_count 1)
|
||||||
elseif(gp_tool STREQUAL "objdump")
|
elseif(gp_tool MATCHES "objdump$")
|
||||||
set(gp_cmd_args "-p")
|
set(gp_cmd_args "-p")
|
||||||
set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$")
|
set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$")
|
||||||
set(gp_regex_error "")
|
set(gp_regex_error "")
|
||||||
@@ -759,7 +759,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(gp_tool STREQUAL "dumpbin")
|
if(gp_tool MATCHES "dumpbin$")
|
||||||
# When running dumpbin, it also needs the "Common7/IDE" directory in the
|
# When running dumpbin, it also needs the "Common7/IDE" directory in the
|
||||||
# PATH. It will already be in the PATH if being run from a Visual Studio
|
# PATH. It will already be in the PATH if being run from a Visual Studio
|
||||||
# command prompt. Add it to the PATH here in case we are running from a
|
# command prompt. Add it to the PATH here in case we are running from a
|
||||||
@@ -788,7 +788,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
|
|||||||
#
|
#
|
||||||
# </setup-gp_tool-vars>
|
# </setup-gp_tool-vars>
|
||||||
|
|
||||||
if(gp_tool STREQUAL "ldd")
|
if(gp_tool MATCHES "ldd$")
|
||||||
set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
|
set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
|
||||||
set(new_ld_env "${exepath}")
|
set(new_ld_env "${exepath}")
|
||||||
foreach(dir ${dirs})
|
foreach(dir ${dirs})
|
||||||
@@ -813,7 +813,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
|
|||||||
ERROR_VARIABLE gp_ev
|
ERROR_VARIABLE gp_ev
|
||||||
)
|
)
|
||||||
|
|
||||||
if(gp_tool STREQUAL "dumpbin")
|
if(gp_tool MATCHES "dumpbin$")
|
||||||
# Exclude delay load dependencies under windows (they are listed in dumpbin output after the message below)
|
# 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)
|
string(FIND "${gp_cmd_ov}" "Image has the following delay load dependencies" gp_delayload_pos)
|
||||||
if (${gp_delayload_pos} GREATER -1)
|
if (${gp_delayload_pos} GREATER -1)
|
||||||
@@ -827,7 +827,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT gp_rv STREQUAL "0")
|
if(NOT gp_rv STREQUAL "0")
|
||||||
if(gp_tool STREQUAL "dumpbin")
|
if(gp_tool MATCHES "dumpbin$")
|
||||||
# dumpbin error messages seem to go to stdout
|
# dumpbin error messages seem to go to stdout
|
||||||
message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}\n${gp_cmd_ov}")
|
message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}\n${gp_cmd_ov}")
|
||||||
else()
|
else()
|
||||||
@@ -835,7 +835,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(gp_tool STREQUAL "ldd")
|
if(gp_tool MATCHES "ldd$")
|
||||||
set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
|
set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -855,7 +855,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
|
|||||||
# check for install id and remove it from list, since otool -L can include a
|
# check for install id and remove it from list, since otool -L can include a
|
||||||
# reference to itself
|
# reference to itself
|
||||||
set(gp_install_id)
|
set(gp_install_id)
|
||||||
if(gp_tool STREQUAL "otool")
|
if(gp_tool MATCHES "otool$")
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${gp_cmd} -D ${target}
|
COMMAND ${gp_cmd} -D ${target}
|
||||||
RESULT_VARIABLE otool_rv
|
RESULT_VARIABLE otool_rv
|
||||||
|
|||||||
Reference in New Issue
Block a user