From 5260a864f5571eeb5697fb2e3b2dda0407de0a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Thu, 28 Feb 2013 15:26:34 +0100 Subject: [PATCH 1/4] GetPrerequisites: Move tool search paths up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make them usable in the gp_tool selection heuristic. Signed-off-by: Michael Tänzer --- Modules/GetPrerequisites.cmake | 35 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 8f2754ed9..c37417c0f 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -567,6 +567,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" + ) + # # # Try to choose the right tool by default. Caller can set gp_tool prior to @@ -582,6 +593,13 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa 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") @@ -619,23 +637,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa 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 From 33c94c82ba7d525e3435248c98132d87415e95a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Thu, 28 Feb 2013 15:28:30 +0100 Subject: [PATCH 2/4] GetPrerequisites: Add support for objdump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it usable on MinGW without Visual Studio installed. Signed-off-by: Michael Tänzer --- Modules/GetPrerequisites.cmake | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index c37417c0f..3bd3fdf23 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -585,11 +585,18 @@ 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() @@ -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. 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() From 8eb2fe955aa42ca54cfcdbaf17dbb11e94d3bbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Fri, 1 Mar 2013 16:26:07 +0100 Subject: [PATCH 3/4] GetPrerequisites: Enable test for BundleUtilities on MinGW MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Tänzer --- Tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 13c2aad4e..8c7b87c35 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") From 12fb50da9f3c9a8de914deb4d516a79109d8912f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Fri, 1 Mar 2013 16:59:49 +0100 Subject: [PATCH 4/4] GetPrerequisites: Add documentation for objdump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Tänzer --- Modules/GetPrerequisites.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 3bd3fdf23..18f449dda 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: