Skip to content

Commit 61958d4

Browse files
committed
build.ps1: sink CMAKE_FIND_PACKAGE_PREFER_CONFIG into Build-CMakeProject
We always prefer the config format so that we are building against the build tree rather than the installed image.
1 parent 5264dd5 commit 61958d4

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

utils/build.ps1

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,10 @@ function Build-CMakeProject {
13201320
Add-KeyValueIfNew $Defines CMAKE_SYSTEM_PROCESSOR $Platform.Architecture.CMakeName
13211321
}
13221322

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+
13231327
switch ($Platform.OS) {
13241328
Windows {
13251329
if ($UseASM) {
@@ -1913,7 +1917,6 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
19131917
return $TestDefines + $DebugDefines + @{
19141918
CLANG_TABLEGEN = (Join-Path -Path $BuildTools -ChildPath "clang-tblgen.exe");
19151919
CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path -Path $BuildTools -ChildPath "clang-tidy-confusable-chars-gen.exe");
1916-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
19171920
CMAKE_Swift_FLAGS = $SwiftFlags;
19181921
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
19191922
LLDB_LIBXML2_VERSION = "2.11.5";
@@ -2484,7 +2487,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
24842487
-UseGNUDriver `
24852488
-Defines @{
24862489
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2487-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
24882490
# TODO(compnerd) enforce dynamic linking of BlocksRuntime and dispatch.
24892491
CMAKE_CXX_FLAGS = $(if ($Static) { @("-Ddispatch_STATIC") } else { @() });
24902492
CMAKE_Swift_FLAGS = $(if ($Static) { @("-Xcc", "-static-libclosure") } else { @() });
@@ -2509,7 +2511,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25092511
-UseGNUDriver `
25102512
-Defines @{
25112513
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2512-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
25132514
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25142515

25152516
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
@@ -2525,7 +2526,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25252526
-UseGNUDriver `
25262527
-Defines @{
25272528
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2528-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
25292529
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25302530

25312531
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
@@ -2541,7 +2541,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25412541
-UseGNUDriver `
25422542
-Defines @{
25432543
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2544-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
25452544
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25462545

25472546
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
@@ -2558,7 +2557,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25582557
-UseGNUDriver `
25592558
-Defines @{
25602559
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2561-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
25622560
# FIXME(#83449): avoid using `SwiftCMakeConfig.h`
25632561
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
25642562
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
@@ -2577,7 +2575,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25772575
-UseGNUDriver `
25782576
-Defines @{
25792577
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2580-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
25812578
# FIXME(#83449): avoid using `SwiftCMakeConfig.h`
25822579
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
25832580
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
@@ -2596,7 +2593,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25962593
-UseGNUDriver `
25972594
-Defines @{
25982595
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2599-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
26002596
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
26012597

26022598
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
@@ -2723,7 +2719,6 @@ function Build-Foundation {
27232719
-SwiftSDK $SwiftSDK `
27242720
-Defines @{
27252721
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2726-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
27272722
CMAKE_NINJA_FORCE_RESPONSE_FILE = "YES";
27282723
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
27292724
CMAKE_Swift_FLAGS = $SwiftFlags;
@@ -2942,7 +2937,6 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
29422937
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
29432938
-Defines @{
29442939
BUILD_SHARED_LIBS = "NO";
2945-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
29462940
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
29472941
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
29482942

@@ -3014,7 +3008,6 @@ function Build-ToolsSupportCore([Hashtable] $Platform) {
30143008
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
30153009
-Defines @{
30163010
BUILD_SHARED_LIBS = "YES";
3017-
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
30183011
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
30193012

30203013
Foundation_DIR = $(Get-ProjectCMakeModules $Platform DynamicFoundation);

0 commit comments

Comments
 (0)