GetPrerequisites: Add support for objdump

Make it usable on MinGW without Visual Studio installed.

Signed-off-by: Michael Tänzer <neo@nhng.de>
This commit is contained in:
Michael Tänzer 2013-02-28 15:28:30 +01:00 committed by Brad King
parent 5260a864f5
commit 33c94c82ba
1 changed files with 18 additions and 2 deletions

View File

@ -585,11 +585,18 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# #
if("${gp_tool}" STREQUAL "") if("${gp_tool}" STREQUAL "")
set(gp_tool "ldd") set(gp_tool "ldd")
if(APPLE) if(APPLE)
set(gp_tool "otool") set(gp_tool "otool")
endif() endif()
if(WIN32 AND NOT UNIX) # This is how to check for cygwin, har! if(WIN32 AND NOT UNIX) # This is how to check for cygwin, har!
find_program(gp_dumpbin "dumpbin" PATHS ${gp_cmd_paths})
if(gp_dumpbin)
set(gp_tool "dumpbin") set(gp_tool "dumpbin")
else() # Try harder. Maybe we're on MinGW
set(gp_tool "objdump")
endif()
endif() endif()
endif() endif()
@ -630,10 +637,19 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE. set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
endif() endif()
if("${gp_tool}" STREQUAL "objdump")
set(gp_cmd_args "-p")
set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$")
set(gp_regex_error "")
set(gp_regex_fallback "")
set(gp_regex_cmp_count 1)
set(gp_tool_known 1)
endif()
if(NOT gp_tool_known) if(NOT gp_tool_known)
message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...") message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...")
message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'") message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'")
message(STATUS "Valid gp_tool values are dumpbin, ldd and otool.") message(STATUS "Valid gp_tool values are dumpbin, ldd, objdump and otool.")
return() return()
endif() endif()