File tree Expand file tree Collapse file tree 2 files changed +10
-32
lines changed Expand file tree Collapse file tree 2 files changed +10
-32
lines changed Original file line number Diff line number Diff line change @@ -71,17 +71,9 @@ sub DeterminePlatform
7171 my $self = shift ;
7272
7373 # Examine CL help output to determine if we are in 32 or 64-bit mode.
74- $self -> {platform } = ' Win32' ;
75- open (P, " cl /? 2>&1 |" ) || die " cl command not found" ;
76- while (<P>)
77- {
78- if (/ ^\/ favor:<.+AMD64/ )
79- {
80- $self -> {platform } = ' x64' ;
81- last ;
82- }
83- }
84- close (P);
74+ my $output = ` cl /? 2>&1` ;
75+ $? >> 8 == 0 or die " cl command not found" ;
76+ $self -> {platform } = ($output =~ / ^\/ favor:<.+AMD64/m ) ? ' x64' : ' Win32' ;
8577 print " Detected hardware platform: $self ->{platform}\n " ;
8678}
8779
Original file line number Diff line number Diff line change @@ -92,30 +92,16 @@ sub CreateProject
9292
9393sub DetermineVisualStudioVersion
9494{
95- my $nmakeVersion = shift ;
96-
97- if (!defined ($nmakeVersion ))
98- {
99-
100- # Determine version of nmake command, to set proper version of visual studio
101- # we use nmake as it has existed for a long time and still exists in current visual studio versions
102- open (P, " nmake /? 2>&1 |" )
103- || croak
104- " Unable to determine Visual Studio version: The nmake command wasn't found." ;
105- while (<P>)
106- {
107- chomp ;
108- if (/ (\d +)\. (\d +)\.\d +(\.\d +)?$ / )
109- {
110- return _GetVisualStudioVersion($1 , $2 );
111- }
112- }
113- close (P);
114- }
115- elsif ($nmakeVersion =~ / (\d +)\. (\d +)\.\d +(\.\d +)?$ / )
95+ # To determine version of Visual Studio we use nmake as it has
96+ # existed for a long time and still exists in current Visual
97+ # Studio versions.
98+ my $output = ` nmake /? 2>&1` ;
99+ $? >> 8 == 0 or croak " Unable to determine Visual Studio version: The nmake command wasn't found." ;
100+ if ($output =~ / (\d +)\. (\d +)\.\d +(\.\d +)?$ /m )
116101 {
117102 return _GetVisualStudioVersion($1 , $2 );
118103 }
104+
119105 croak
120106" Unable to determine Visual Studio version: The nmake version could not be determined." ;
121107}
You can’t perform that action at this time.
0 commit comments