summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
authorEvan Wilde <etceterawilde@gmail.com>2023-11-06 00:36:28 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-17 13:43:21 (GMT)
commitc1d787e4734ca107e8ae084b3832e441651a6266 (patch)
tree9622a28a3c0e14caa452ac4ddb6733fa83564088 /Source/cmCoreTryCompile.cxx
parentc39384f54019adce87d676a7ed6d8e772ce5b7f8 (diff)
downloadCMake-c1d787e4734ca107e8ae084b3832e441651a6266.zip
CMake-c1d787e4734ca107e8ae084b3832e441651a6266.tar.gz
CMake-c1d787e4734ca107e8ae084b3832e441651a6266.tar.bz2
Swift: Add abstraction for compilation mode
Add a `CMAKE_Swift_COMPILATION_MODE` variable and corresponding `Swift_COMPILATION_MODE` target property to control the compilation mode. Select among `wholemodule`, `singlefile`, and `incremental`. Add policy CMP0157 to remove the default `-wmo` flags in favor of the abstract setting. Issue: #25366
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 7f7c747..fa30b06 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -904,6 +904,14 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
? "NEW"
: "OLD");
+ /* Set the appropriate policy information for Swift compilation mode */
+ fprintf(
+ fout, "cmake_policy(SET CMP0157 %s)\n",
+ this->Makefile->GetDefinition("CMAKE_Swift_COMPILATION_MODE_DEFAULT")
+ .IsEmpty()
+ ? "OLD"
+ : "NEW");
+
// Workaround for -Wl,-headerpad_max_install_names issue until we can avoid
// adding that flag in the platform and compiler language files
fprintf(fout,