File tree 1 file changed +19
-3
lines changed
1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -413,9 +413,25 @@ impl Config {
413
413
} else {
414
414
using_nmake_generator = self . generator . as_ref ( ) . unwrap ( ) == "NMake Makefiles" ;
415
415
}
416
- if target. contains ( "x86_64" ) && !is_ninja && !using_nmake_generator {
417
- cmd. arg ( "-Thost=x64" ) ;
418
- cmd. arg ( "-DCMAKE_GENERATOR_PLATFORM=x64" ) ;
416
+ if !is_ninja && !using_nmake_generator {
417
+ if target. contains ( "x86_64" ) {
418
+ cmd. arg ( "-Thost=x64" ) ;
419
+ cmd. arg ( "-Ax64" ) ;
420
+ } else if target. contains ( "i686" ) {
421
+ use cc:: windows_registry:: { find_vs_version, VsVers } ;
422
+ match find_vs_version ( ) {
423
+ Ok ( VsVers :: Vs16 ) => {
424
+ // 32-bit x86 toolset used to be the default for all hosts,
425
+ // but Visual Studio 2019 changed the default toolset to match the host,
426
+ // so we need to manually override it for x86 targets
427
+ cmd. arg ( "-Thost=x86" ) ;
428
+ cmd. arg ( "-AWin32" ) ;
429
+ }
430
+ _ => { }
431
+ } ;
432
+ } else {
433
+ panic ! ( "unsupported msvc target: {}" , target) ;
434
+ }
419
435
}
420
436
} else if target. contains ( "redox" ) {
421
437
if !self . defined ( "CMAKE_SYSTEM_NAME" ) {
You can’t perform that action at this time.
0 commit comments