From 1911daa1294edffd033a5e11bae33e13dc61d0a6 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 6 Jul 2004 07:36:26 +0000 Subject: [PATCH] Fix msvc initialization. When version is specified, look in default paths before looking in PATH. [SVN r23363] --- v2/tools/common.jam | 28 +++++++++++++++++++++++----- v2/tools/msvc.jam | 6 ++++-- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/v2/tools/common.jam b/v2/tools/common.jam index 6ad4f219f..798b61ead 100644 --- a/v2/tools/common.jam +++ b/v2/tools/common.jam @@ -109,13 +109,14 @@ rule check-init-parameters ( toolset : * ) # to find the tool using it's name, the PATH, and additional path. # This rule returns the command to be used when invoking the tool. If we can't # find the tool, a warning is issued. +# If 'path-last' is specified, path is checked after 'additional-paths'. rule get-invocation-command ( - toolset : tool : user-provided-command * : additional-paths * ) + toolset : tool : user-provided-command * : additional-paths * : path-last ? ) { local command ; if ! $(user-provided-command) { - command = [ common.find-tool $(tool) : $(additional-paths) ] ; + command = [ common.find-tool $(tool) : $(additional-paths) : path-last ] ; if ! $(command) { ECHO "warning: toolset $(toolset) initialization: can't find tool $(tool)" ; @@ -161,16 +162,33 @@ rule get-absolute-tool-path ( command ) # If found in additional paths, returns full name. If there are several possibilities, # returns them all. # Otherwise, returns empty string. -rule find-tool ( name : additional-paths * ) +# If 'path-last' is specified, path is checked after 'additional-paths'. +rule find-tool ( name : additional-paths * : path-last ? ) { - local m = [ GLOB [ modules.peek : PATH Path path ] : $(name) $(name).exe ] ; + local m ; + if $(path-last) + { + m = [ path.glob $(additional-paths) : $(name) $(name).exe ] ; + } + else + { + m = [ GLOB [ modules.peek : PATH Path path ] : $(name) $(name).exe ] ; + } + if $(m) { return $(name) ; } else { - return [ path.glob $(additional-paths) : $(name) $(name).exe ] ; + if $(path-last) + { + return [ GLOB [ modules.peek : PATH Path path ] : $(name) $(name).exe ] ; + } + else + { + return [ path.glob $(additional-paths) : $(name) $(name).exe ] ; + } } } diff --git a/v2/tools/msvc.jam b/v2/tools/msvc.jam index bcdc1936b..7584ce878 100644 --- a/v2/tools/msvc.jam +++ b/v2/tools/msvc.jam @@ -73,9 +73,11 @@ rule init ( local condition = [ common.check-init-parameters msvc : version $(version) ] ; - + + # If version is specified, we try to search first in default paths, + # and only then in PATH. command = [ common.get-invocation-command msvc : cl.exe : $(command) - : [ default-paths $(version) ] ] ; + : [ default-paths $(version) ] : $(version) ] ; if $(command) {