From 5897ab557e285b93af6e43b4a7adbb65d75d8aa2 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Tue, 9 May 2023 11:17:41 +0100 Subject: [PATCH] CMake: fix missing `SWIFT_CONCURRENCY_GLOBAL_EXECUTOR` value `SWIFT_CONCURRENCY_GLOBAL_EXECUTOR` is defined in `stdlib/cmake/modules/StdlibOptions.cmake`, which is not included during the first pass of evaluation of the root `CMakeLists.txt`. It is available on subsequent evaluations after the value is stored in CMake cache. This led to subtle bugs, where `usr/lib/swift_static/linux/static-stdlib-args.lnk` didn't contain certain flags on clean toolchain builds, but did contain them in incremental builds. Not having these autolinking flags in toolchain builds leads to errors when statically linking executables on Linux. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2ab512a9f20f..a7bf97d3cf3c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,10 @@ set(SWIFT_HOST_VARIANT_ARCH "${SWIFT_HOST_VARIANT_ARCH_default}" CACHE STRING # This is primarily to support building smaller or faster project files. # +# Subsequent options may refer to `StdlibOptions`, which have to be defined first. +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/stdlib/cmake/modules) +include(StdlibOptions) + option(SWIFT_APPEND_VC_REV "Embed the version control system revision in Swift" TRUE)