GetPrerequisites: join if() clauses

These all test the same variable for different values, so only one of them can
ever be true. This also allows to completely remove one variable that only
flagged if one of the conditions matched.
This commit is contained in:
Rolf Eike Beer 2014-11-18 20:37:33 +01:00 committed by Brad King
parent c9e32b0b12
commit d1903de8c5
1 changed files with 4 additions and 18 deletions

View File

@ -666,45 +666,31 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
return() return()
endif() endif()
set(gp_tool_known 0)
if(gp_tool STREQUAL "ldd") if(gp_tool STREQUAL "ldd")
set(gp_cmd_args "") set(gp_cmd_args "")
set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$") set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$")
set(gp_regex_error "not found${eol_char}$") set(gp_regex_error "not found${eol_char}$")
set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$") set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$")
set(gp_regex_cmp_count 1) set(gp_regex_cmp_count 1)
set(gp_tool_known 1) elseif(gp_tool STREQUAL "otool")
endif()
if(gp_tool STREQUAL "otool")
set(gp_cmd_args "-L") set(gp_cmd_args "-L")
set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$") set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
set(gp_regex_error "") set(gp_regex_error "")
set(gp_regex_fallback "") set(gp_regex_fallback "")
set(gp_regex_cmp_count 3) set(gp_regex_cmp_count 3)
set(gp_tool_known 1) elseif(gp_tool STREQUAL "dumpbin")
endif()
if(gp_tool STREQUAL "dumpbin")
set(gp_cmd_args "/dependents") set(gp_cmd_args "/dependents")
set(gp_regex "^ ([^ ].*[Dd][Ll][Ll])${eol_char}$") set(gp_regex "^ ([^ ].*[Dd][Ll][Ll])${eol_char}$")
set(gp_regex_error "") set(gp_regex_error "")
set(gp_regex_fallback "") set(gp_regex_fallback "")
set(gp_regex_cmp_count 1) set(gp_regex_cmp_count 1)
set(gp_tool_known 1) elseif(gp_tool STREQUAL "objdump")
endif()
if(gp_tool STREQUAL "objdump")
set(gp_cmd_args "-p") set(gp_cmd_args "-p")
set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$") set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$")
set(gp_regex_error "") set(gp_regex_error "")
set(gp_regex_fallback "") set(gp_regex_fallback "")
set(gp_regex_cmp_count 1) set(gp_regex_cmp_count 1)
set(gp_tool_known 1) else()
endif()
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, objdump and otool.") message(STATUS "Valid gp_tool values are dumpbin, ldd, objdump and otool.")