Hey,
I worked on a patch for supporting dep-tracking with GetPrequesites when
cross-compiling for Windows with MinGW.
While doing this I noticed neither WIN32 nor CMAKE_CROSSCOMPILING are
defined at CPack time, why?
This is the reason my code in the patch is not in the WIN32 block above and
I couldn't guess the gp_tool correctly.
A hardcoded list of .dll names is for sure not really elegant, but I don't
know of any way to check if a required .dll is a windows system library. On
Linux of course there are no Windows system dlls in a certain folder and
the absence of such a dll doesn't mean anything either because an import
lib (.dll.a usually) is enough to link against.
The patch is probably not ready to be upstreamed but I'm happy to fix
issues or follow a nicer approach if you point me to it.
Best regards,
Dominik
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 8761f40..304a0d6 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -476,6 +476,56 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
endif(UNIX)
endif(WIN32)
+ set(windows_system_libraries
+ "advapi32.dll"
+ "cfgmgr32.dll"
+ "comctl32.dll"
+ "comdlg32.dll"
+ "crypt32.dll"
+ "ddraw.dll"
+ "dnsapi.dll"
+ "dsound.dll"
+ "gdi32.dll"
+ "gdiplus.dll"
+ "glu32.dll"
+ "glut32.dll"
+ "imm32.dll"
+ "iphlpapi.dll"
+ "kernel32.dll"
+ "mscms.dll"
+ "mscoree.dll"
+ "msimg32.dll"
+ "msvcr71.dll"
+ "msvcr80.dll"
+ "msvcr90.dll"
+ "msvcrt.dll"
+ "mswsock.dll"
+ "ole32.dll"
+ "oleaut32.dll"
+ "opengl32.dll"
+ "psapi.dll"
+ "rpcrt4.dll"
+ "secur32.dll"
+ "setupapi.dll"
+ "shell32.dll"
+ "shlwapi.dll"
+ "user32.dll"
+ "usp10.dll"
+ "version.dll"
+ "wininet.dll"
+ "winmm.dll"
+ "wldap32.dll"
+ "ws2_32.dll"
+ "wsock32.dll"
+ )
+
+ string(TOLOWER "${file}" file_lower)
+ foreach(windows_system_library ${windows_system_libraries})
+ if( "${file_lower}" STREQUAL "${windows_system_library}")
+ set(is_system 1)
+ endif()
+ endforeach()
+
if(NOT is_system)
get_filename_component(original_path "${original_lower}" PATH)
get_filename_component(path "${lower}" PATH)
@@ -573,6 +623,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif(WIN32 AND NOT UNIX)
endif("${gp_tool}" STREQUAL "")
+ set(gp_tool "objdump")
set(gp_tool_known 0)
if("${gp_tool}" STREQUAL "ldd")
@@ -603,6 +654,15 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
endif("${gp_tool}" STREQUAL "dumpbin")
+ if("${gp_tool}" STREQUAL "objdump")
+ set(gp_cmd_args "-p")
+ set(gp_regex ".*DLL Name: ([^ ]*[Dd][Ll][Ll])${eol_char}$")
+ set(gp_regex_error "")
+ set(gp_regex_fallback "")
+ set(gp_regex_cmp_count 0)
+ 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}'")
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers