summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeSwiftInformation.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-29 13:13:20 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-03-29 13:13:33 (GMT)
commitd79237a58085076f21de4a489afac2ef766df483 (patch)
tree2d40a3ccbe6328049597c21eeac486f900fbb877 /Modules/CMakeSwiftInformation.cmake
parent79a8f6da5d7702e7a88b9d9e9d1be9e9082c89bd (diff)
parent006e1995ebd279052290bf3e25eb814ba09a0dcc (diff)
downloadCMake-d79237a58085076f21de4a489afac2ef766df483.zip
CMake-d79237a58085076f21de4a489afac2ef766df483.tar.gz
CMake-d79237a58085076f21de4a489afac2ef766df483.tar.bz2
Merge topic 'swift-old-driver'
006e1995eb Swift: Restore compatibility with old C++ driver Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8365
Diffstat (limited to 'Modules/CMakeSwiftInformation.cmake')
-rw-r--r--Modules/CMakeSwiftInformation.cmake14
1 files changed, 11 insertions, 3 deletions
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index d27aa3f..777c680 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -78,9 +78,17 @@ if(CMAKE_GENERATOR STREQUAL "Xcode")
set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")
else()
set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g -incremental")
- set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O -wmo")
- set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g -wmo")
- set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize -wmo")
+ set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
+ set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g")
+ set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")
+
+ # Enable Whole Module Optimization by default unless the old
+ # C++ driver is being used, which behaves differently under WMO.
+ if(NOT CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
+ string(APPEND CMAKE_Swift_FLAGS_RELEASE_INIT " -wmo")
+ string(APPEND CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT " -wmo")
+ string(APPEND CMAKE_Swift_FLAGS_MINSIZEREL_INIT " -wmo")
+ endif()
endif()
if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")