mirror of
https://github.com/reactos/CMake.git
synced 2025-01-19 01:42:18 +00:00
Fixes to GetPrerequisites for cygwin
Fix IF(WIN32) guards check for cygwin. Fix checking if the depenency is in a system location to use cygwin style paths on cygwin. Also change GetPrerequisites to switch gp_tool to tools that are very unlikely to be found, ie. dumpbin on Apple and otool on Windows/Unix.
This commit is contained in:
parent
bee4802840
commit
48e80eb724
@ -146,7 +146,7 @@ function(is_file_executable file result_var)
|
|||||||
|
|
||||||
# If file name ends in .exe on Windows, *assume* executable:
|
# If file name ends in .exe on Windows, *assume* executable:
|
||||||
#
|
#
|
||||||
if(WIN32)
|
if(WIN32 AND NOT UNIX)
|
||||||
if("${file_full_lower}" MATCHES "\\.exe$")
|
if("${file_full_lower}" MATCHES "\\.exe$")
|
||||||
set(${result_var} 1 PARENT_SCOPE)
|
set(${result_var} 1 PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
@ -156,7 +156,7 @@ function(is_file_executable file result_var)
|
|||||||
# to determine ${result_var}. In 99%+? practical cases, the exe name
|
# to determine ${result_var}. In 99%+? practical cases, the exe name
|
||||||
# match will be sufficient...
|
# match will be sufficient...
|
||||||
#
|
#
|
||||||
endif(WIN32)
|
endif(WIN32 AND NOT UNIX)
|
||||||
|
|
||||||
# Use the information returned from the Unix shell command "file" to
|
# Use the information returned from the Unix shell command "file" to
|
||||||
# determine if ${file_full} should be considered an executable file...
|
# determine if ${file_full} should be considered an executable file...
|
||||||
@ -335,7 +335,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
|
|||||||
# Using find_program on Windows will find dll files that are in the PATH.
|
# Using find_program on Windows will find dll files that are in the PATH.
|
||||||
# (Converting simple file names into full path names if found.)
|
# (Converting simple file names into full path names if found.)
|
||||||
#
|
#
|
||||||
if(WIN32)
|
if(WIN32 AND NOT UNIX)
|
||||||
if(NOT resolved)
|
if(NOT resolved)
|
||||||
set(ri "ri-NOTFOUND")
|
set(ri "ri-NOTFOUND")
|
||||||
find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
|
find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
|
||||||
@ -347,7 +347,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
|
|||||||
set(ri "ri-NOTFOUND")
|
set(ri "ri-NOTFOUND")
|
||||||
endif(ri)
|
endif(ri)
|
||||||
endif(NOT resolved)
|
endif(NOT resolved)
|
||||||
endif(WIN32)
|
endif(WIN32 AND NOT UNIX)
|
||||||
|
|
||||||
# Provide a hook so that projects can override item resolution
|
# Provide a hook so that projects can override item resolution
|
||||||
# by whatever logic they choose:
|
# by whatever logic they choose:
|
||||||
@ -413,7 +413,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
|
|||||||
string(TOLOWER "${resolved_file}" lower)
|
string(TOLOWER "${resolved_file}" lower)
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)")
|
if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/|/usr/bin/)")
|
||||||
set(is_system 1)
|
set(is_system 1)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -434,7 +434,27 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
|
|||||||
if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
|
if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
|
||||||
set(is_system 1)
|
set(is_system 1)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
if(UNIX)
|
||||||
|
# if cygwin, we can get the properly formed windows paths from cygpath
|
||||||
|
find_program(CYGPATH_EXECUTABLE cygpath)
|
||||||
|
|
||||||
|
if(CYGPATH_EXECUTABLE)
|
||||||
|
execute_process(COMMAND ${CYGPATH_EXECUTABLE} -W
|
||||||
|
OUTPUT_VARIABLE env_windir
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
execute_process(COMMAND ${CYGPATH_EXECUTABLE} -S
|
||||||
|
OUTPUT_VARIABLE env_sysdir
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
string(TOLOWER "${env_windir}" windir)
|
||||||
|
string(TOLOWER "${env_sysdir}" sysroot)
|
||||||
|
|
||||||
|
if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
|
||||||
|
set(is_system 1)
|
||||||
|
endif()
|
||||||
|
endif(CYGPATH_EXECUTABLE)
|
||||||
|
endif(UNIX)
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
if(NOT is_system)
|
if(NOT is_system)
|
||||||
get_filename_component(original_path "${original_lower}" PATH)
|
get_filename_component(original_path "${original_lower}" PATH)
|
||||||
@ -519,9 +539,9 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
|
|||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(gp_tool "otool")
|
set(gp_tool "otool")
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
if(WIN32)
|
if(WIN32 AND NOT UNIX) # This is how to check for cygwin, har!
|
||||||
set(gp_tool "dumpbin")
|
set(gp_tool "dumpbin")
|
||||||
endif(WIN32)
|
endif(WIN32 AND NOT UNIX)
|
||||||
endif("${gp_tool}" STREQUAL "")
|
endif("${gp_tool}" STREQUAL "")
|
||||||
|
|
||||||
set(gp_tool_known 0)
|
set(gp_tool_known 0)
|
||||||
|
@ -121,11 +121,11 @@ message(STATUS "")
|
|||||||
message(STATUS "=============================================================================")
|
message(STATUS "=============================================================================")
|
||||||
message(STATUS "Test overriding 'gp_tool' with value unlikely to be found")
|
message(STATUS "Test overriding 'gp_tool' with value unlikely to be found")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
if(WIN32 OR APPLE)
|
if(APPLE)
|
||||||
set(gp_tool "ldd")
|
set(gp_tool "dumpbin")
|
||||||
else(WIN32 OR APPLE)
|
else()
|
||||||
set(gp_tool "otool")
|
set(gp_tool "otool")
|
||||||
endif(WIN32 OR APPLE)
|
endif()
|
||||||
set(gp_cmd "gp_cmd-NOTFOUND")
|
set(gp_cmd "gp_cmd-NOTFOUND")
|
||||||
list_prerequisites("${CMAKE_COMMAND}" 0 0 0)
|
list_prerequisites("${CMAKE_COMMAND}" 0 0 0)
|
||||||
set(gp_cmd)
|
set(gp_cmd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user