@@ -1320,6 +1320,10 @@ function Build-CMakeProject {
1320
1320
Add-KeyValueIfNew $Defines CMAKE_SYSTEM_PROCESSOR $Platform.Architecture.CMakeName
1321
1321
}
1322
1322
1323
+ # Always prefer the CONFIG format for the packages so that we can build
1324
+ # against the build tree.
1325
+ Add-KeyValueIfNew $Defines CMAKE_FIND_PACKAGE_PREFER_CONFIG YES
1326
+
1323
1327
switch ($Platform.OS ) {
1324
1328
Windows {
1325
1329
if ($UseASM ) {
@@ -1913,7 +1917,6 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
1913
1917
return $TestDefines + $DebugDefines + @ {
1914
1918
CLANG_TABLEGEN = (Join-Path - Path $BuildTools - ChildPath " clang-tblgen.exe" );
1915
1919
CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path - Path $BuildTools - ChildPath " clang-tidy-confusable-chars-gen.exe" );
1916
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
1917
1920
CMAKE_Swift_FLAGS = $SwiftFlags ;
1918
1921
LibXml2_DIR = " $BinaryCache \$ ( $Platform.Triple ) \usr\lib\cmake\libxml2-2.11.5" ;
1919
1922
LLDB_LIBXML2_VERSION = " 2.11.5" ;
@@ -2484,7 +2487,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2484
2487
- UseGNUDriver `
2485
2488
- Defines @ {
2486
2489
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2487
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2488
2490
# TODO(compnerd) enforce dynamic linking of BlocksRuntime and dispatch.
2489
2491
CMAKE_CXX_FLAGS = $ (if ($Static ) { @ (" -Ddispatch_STATIC" ) } else { @ () });
2490
2492
CMAKE_Swift_FLAGS = $ (if ($Static ) { @ (" -Xcc" , " -static-libclosure" ) } else { @ () });
@@ -2509,7 +2511,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2509
2511
- UseGNUDriver `
2510
2512
- Defines @ {
2511
2513
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2512
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2513
2514
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2514
2515
2515
2516
SwiftCore_DIR = " ${RuntimeBinaryCache} \cmake\SwiftCore" ;
@@ -2525,7 +2526,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2525
2526
- UseGNUDriver `
2526
2527
- Defines @ {
2527
2528
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2528
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2529
2529
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2530
2530
2531
2531
SwiftCore_DIR = " ${RuntimeBinaryCache} \cmake\SwiftCore" ;
@@ -2541,7 +2541,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2541
2541
- UseGNUDriver `
2542
2542
- Defines @ {
2543
2543
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2544
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2545
2544
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2546
2545
2547
2546
SwiftCore_DIR = " ${RuntimeBinaryCache} \cmake\SwiftCore" ;
@@ -2558,7 +2557,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2558
2557
- UseGNUDriver `
2559
2558
- Defines @ {
2560
2559
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2561
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2562
2560
# FIXME(#83449): avoid using `SwiftCMakeConfig.h`
2563
2561
CMAKE_CXX_FLAGS = @ (" -I${RuntimeBinaryCache} \include" );
2564
2562
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2577,7 +2575,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2577
2575
- UseGNUDriver `
2578
2576
- Defines @ {
2579
2577
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2580
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2581
2578
# FIXME(#83449): avoid using `SwiftCMakeConfig.h`
2582
2579
CMAKE_CXX_FLAGS = @ (" -I${RuntimeBinaryCache} \include" );
2583
2580
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2596,7 +2593,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2596
2593
- UseGNUDriver `
2597
2594
- Defines @ {
2598
2595
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2599
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2600
2596
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2601
2597
2602
2598
SwiftCore_DIR = " ${RuntimeBinaryCache} \cmake\SwiftCore" ;
@@ -2723,7 +2719,6 @@ function Build-Foundation {
2723
2719
- SwiftSDK $SwiftSDK `
2724
2720
- Defines @ {
2725
2721
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2726
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2727
2722
CMAKE_NINJA_FORCE_RESPONSE_FILE = " YES" ;
2728
2723
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2729
2724
CMAKE_Swift_FLAGS = $SwiftFlags ;
@@ -2942,7 +2937,6 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
2942
2937
- SwiftSDK (Get-SwiftSDK $Platform.OS - Identifier " $ ( $Platform.OS ) Experimental" ) `
2943
2938
- Defines @ {
2944
2939
BUILD_SHARED_LIBS = " NO" ;
2945
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2946
2940
CMAKE_Swift_FLAGS = @ (" -static-stdlib" , " -Xfrontend" , " -use-static-resource-dir" );
2947
2941
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2948
2942
@@ -3014,7 +3008,6 @@ function Build-ToolsSupportCore([Hashtable] $Platform) {
3014
3008
- SwiftSDK (Get-SwiftSDK $Platform.OS ) `
3015
3009
- Defines @ {
3016
3010
BUILD_SHARED_LIBS = " YES" ;
3017
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
3018
3011
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
3019
3012
3020
3013
Foundation_DIR = $ (Get-ProjectCMakeModules $Platform DynamicFoundation);
0 commit comments