diff options
author | Brad King <brad.king@kitware.com> | 2013-03-04 20:40:24 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-03-04 20:40:24 (GMT) |
commit | e162d88fbb7ffa43da3be82a6df4542c8fa3113a (patch) | |
tree | 30731b7e778c9f176268f8268b5ada2f17e73103 | |
parent | e6b4641bfa55aff2d65bbe0c90432b17ce3ddea5 (diff) | |
parent | 12fb50da9f3c9a8de914deb4d516a79109d8912f (diff) | |
download | CMake-e162d88fbb7ffa43da3be82a6df4542c8fa3113a.zip CMake-e162d88fbb7ffa43da3be82a6df4542c8fa3113a.tar.gz CMake-e162d88fbb7ffa43da3be82a6df4542c8fa3113a.tar.bz2 |
Merge topic 'GetPrerequisites-objdump'
12fb50d GetPrerequisites: Add documentation for objdump
8eb2fe9 GetPrerequisites: Enable test for BundleUtilities on MinGW
33c94c8 GetPrerequisites: Add support for objdump
5260a86 GetPrerequisites: Move tool search paths up
-rw-r--r-- | Modules/GetPrerequisites.cmake | 56 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 1 |
2 files changed, 38 insertions, 19 deletions
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 8f2754e..18f449d 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -5,6 +5,7 @@ # # It uses various tools to obtain the list of required shared library files: # dumpbin (Windows) +# objdump (MinGW on Windows) # ldd (Linux/Unix) # otool (Mac OSX) # The following functions are provided by this module: @@ -567,6 +568,17 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa message("warning: target '${target}' does not exist...") endif() + set(gp_cmd_paths ${gp_cmd_paths} + "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin" + "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin" + "C:/Program Files/Microsoft Visual Studio 8/VC/BIN" + "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN" + "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN" + "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN" + "/usr/local/bin" + "/usr/bin" + ) + # <setup-gp_tool-vars> # # Try to choose the right tool by default. Caller can set gp_tool prior to @@ -574,14 +586,28 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # if("${gp_tool}" STREQUAL "") set(gp_tool "ldd") + if(APPLE) set(gp_tool "otool") endif() + if(WIN32 AND NOT UNIX) # This is how to check for cygwin, har! - set(gp_tool "dumpbin") + find_program(gp_dumpbin "dumpbin" PATHS ${gp_cmd_paths}) + if(gp_dumpbin) + set(gp_tool "dumpbin") + else() # Try harder. Maybe we're on MinGW + set(gp_tool "objdump") + endif() endif() endif() + find_program(gp_cmd ${gp_tool} PATHS ${gp_cmd_paths}) + + if(NOT gp_cmd) + message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...") + return() + endif() + set(gp_tool_known 0) if("${gp_tool}" STREQUAL "ldd") @@ -612,30 +638,22 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE. 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) 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 "Valid gp_tool values are dumpbin, ldd and otool.") + message(STATUS "Valid gp_tool values are dumpbin, ldd, objdump and otool.") return() endif() - set(gp_cmd_paths ${gp_cmd_paths} - "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin" - "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin" - "C:/Program Files/Microsoft Visual Studio 8/VC/BIN" - "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN" - "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN" - "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN" - "/usr/local/bin" - "/usr/bin" - ) - - find_program(gp_cmd ${gp_tool} PATHS ${gp_cmd_paths}) - - if(NOT gp_cmd) - message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...") - return() - endif() if("${gp_tool}" STREQUAL "dumpbin") # When running dumpbin, it also needs the "Common7/IDE" directory in the diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 13c2aad..8c7b87c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -287,6 +287,7 @@ if(BUILD_TESTING) # run test for BundleUtilities on supported platforms/compilers if(MSVC OR + MINGW OR CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin") if(NOT "${CMAKE_TEST_GENERATOR}" STREQUAL "Watcom WMake") |