Skip to content

build: fix accidental cmake expansions #65534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enable_language(CXX)
set(SWIFT_ASM_DIALECT ASM)
set(SWIFT_ASM_EXT S)
set(SWIFT_ASM_AVAILABLE YES)
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
if(CMAKE_VERSION VERSION_LESS "3.26")
message(warning "We can't build assembly language for ARM64 until CMake 3.26")
Expand Down Expand Up @@ -158,7 +158,7 @@ else()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|amd64")
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64")
if(SWIFT_HOST_VARIANT_SDK_default STREQUAL OSX)
if(SWIFT_HOST_VARIANT_SDK_default STREQUAL "OSX")
set(SWIFT_HOST_VARIANT_ARCH_default "arm64")
else()
set(SWIFT_HOST_VARIANT_ARCH_default "aarch64")
Expand Down Expand Up @@ -380,7 +380,7 @@ set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
# - MultiThreadedDebug (/MTd)
# - MultiThreadedDLL (/MD)
# - MultiThreadedDebugDLL (/MDd)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY_default MultiThreadedDebugDLL)
else()
set(SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY_default MultiThreadedDLL)
Expand Down Expand Up @@ -675,7 +675,7 @@ if(SWIFT_BUILT_STANDALONE)
project(Swift C CXX ${SWIFT_ASM_DIALECT})
endif()

if(MSVC OR "${CMAKE_SIMULATE_ID}" STREQUAL MSVC)
if(MSVC OR "${CMAKE_SIMULATE_ID}" STREQUAL "MSVC")
include(ClangClCompileRules)
elseif(UNIX)
include(UnixCompileRules)
Expand All @@ -697,7 +697,7 @@ if(NOT EXISTS "${SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE}")
endif()

set(SWIFT_BUILD_HOST_DISPATCH FALSE)
if(SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Only build libdispatch for the host if the host tools are being built and
# specifically if these two libraries that depend on it are built.
if(SWIFT_INCLUDE_TOOLS AND SWIFT_BUILD_SOURCEKIT)
Expand Down Expand Up @@ -883,11 +883,11 @@ endif()
# build environment.
if(LLVM_USE_LINKER)
set(SWIFT_USE_LINKER_default "${LLVM_USE_LINKER}")
elseif(${SWIFT_HOST_VARIANT_SDK} STREQUAL ANDROID)
elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
set(SWIFT_USE_LINKER_default "lld")
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(SWIFT_USE_LINKER_default "lld")
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(SWIFT_USE_LINKER_default "")
else()
set(SWIFT_USE_LINKER_default "gold")
Expand Down
16 changes: 8 additions & 8 deletions SwiftCompilerSources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function(add_swift_compiler_modules_library name)
list(APPEND swift_compile_options "-Xfrontend" "-disable-implicit-string-processing-module-import")
endif()

if(CMAKE_BUILD_TYPE STREQUAL Debug)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND swift_compile_options "-g")
else()
list(APPEND swift_compile_options "-O" "-cross-module-optimization")
Expand All @@ -103,7 +103,7 @@ function(add_swift_compiler_modules_library name)
set(deployment_version "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
set(sdk_path "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
set(sdk_option "-sdk" "${sdk_path}")
if(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE-WITH-HOSTLIBS")
if(BOOTSTRAPPING_MODE STREQUAL "CROSSCOMPILE-WITH-HOSTLIBS")
# Let the cross-compiled compile don't pick up the compiled stdlib by providing
# an (almost) empty resource dir.
# The compiler will instead pick up the stdlib from the SDK.
Expand All @@ -122,7 +122,7 @@ function(add_swift_compiler_modules_library name)
message(ERROR "libc++ not found in the toolchain.")
endif()
endif()
elseif(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE")
elseif(BOOTSTRAPPING_MODE STREQUAL "CROSSCOMPILE")
set(sdk_option "-sdk" "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY)
set(sdk_option ${sdk_option} "-resource-dir" "${swift_exec_bin_dir}/../lib/swift")
Expand Down Expand Up @@ -259,13 +259,13 @@ else()
add_dependencies(importedHeaderDependencies swift-ast-generated-headers)
target_include_directories(importedHeaderDependencies PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../include/swift")

if(${BOOTSTRAPPING_MODE} MATCHES "HOSTTOOLS|CROSSCOMPILE")
if(BOOTSTRAPPING_MODE MATCHES "HOSTTOOLS|CROSSCOMPILE")

if (NOT SWIFT_EXEC_FOR_SWIFT_MODULES)
message(FATAL_ERROR "Need a swift toolchain building swift compiler sources")
endif()

if(${BOOTSTRAPPING_MODE} STREQUAL "HOSTTOOLS")
if(BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
if(NOT SWIFT_EXEC_FOR_SWIFT_MODULES STREQUAL CMAKE_Swift_COMPILER)
message(FATAL_ERROR "The Swift compiler (${CMAKE_Swift_COMPILER}) differs from the Swift compiler in SWIFT_NATIVE_SWIFT_TOOLS_PATH (${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc).")
endif()
Expand All @@ -281,11 +281,11 @@ else()
add_swift_compiler_modules_library(swiftCompilerModules
SWIFT_EXEC "${SWIFT_EXEC_FOR_SWIFT_MODULES}")

elseif(${BOOTSTRAPPING_MODE} MATCHES "BOOTSTRAPPING.*")
elseif(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")

set(b0_deps swift-frontend-bootstrapping0 symlink-headers-bootstrapping0)
set(b1_deps swift-frontend-bootstrapping1 symlink-headers-bootstrapping1)
if(${BOOTSTRAPPING_MODE} STREQUAL "BOOTSTRAPPING")
if(BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING")
list(APPEND b0_deps swiftCore-bootstrapping0)
list(APPEND b1_deps swiftCore-bootstrapping1)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand All @@ -296,7 +296,7 @@ else()
list(APPEND b0_deps swiftDarwin-bootstrapping0)
list(APPEND b1_deps swiftDarwin-bootstrapping1)
endif()
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_LIBSTDCXX_PLATFORMS)
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_LIBSTDCXX_PLATFORMS)
list(APPEND b0_deps copy-libstdcxx-modulemap-bootstrapping0 copy-libstdcxx-header-bootstrapping0)
list(APPEND b1_deps copy-libstdcxx-modulemap-bootstrapping1 copy-libstdcxx-header-bootstrapping1)
endif()
Expand Down
4 changes: 2 additions & 2 deletions benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ macro(configure_build)
# thus allowing the --host-cc build-script argument to work here.
get_filename_component(c_compiler ${CMAKE_C_COMPILER} NAME)

if(${c_compiler} STREQUAL "clang")
if(c_compiler STREQUAL "clang")
set(CLANG_EXEC ${CMAKE_C_COMPILER})
else()
if(NOT SWIFT_DARWIN_XCRUN_TOOLCHAIN)
Expand Down Expand Up @@ -713,7 +713,7 @@ function(swift_benchmark_compile)

if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
endif()
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
Expand Down
6 changes: 3 additions & 3 deletions cmake/modules/AddPureSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function(_add_host_swift_compile_options name)
set(DEPLOYMENT_VERSION "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
endif()

if(SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID)
if(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
set(DEPLOYMENT_VERSION ${SWIFT_ANDROID_API_LEVEL})
endif()

Expand Down Expand Up @@ -141,7 +141,7 @@ function(add_pure_swift_host_library name)
set_property(TARGET ${name}
PROPERTY BUILD_WITH_INSTALL_RPATH YES)

if(APSHL_SHARED AND CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(APSHL_SHARED AND CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Allow install_name_tool to update paths (for rdar://109473564)
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Xlinker -headerpad_max_install_names")
Expand Down Expand Up @@ -267,7 +267,7 @@ function(add_pure_swift_host_tool name)
add_executable(${name} ${APSHT_SOURCES})
_add_host_swift_compile_options(${name})

if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
set_property(TARGET ${name}
APPEND PROPERTY INSTALL_RPATH
"@executable_path/../lib/swift/host")
Expand Down
Loading