mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:
- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
expands to 1, where it would previously coerce to a string.
- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
left-hand side expands twice.
In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:
- Quoted right-hand side of `STREQUAL` where I was confident it was
intended to be a string literal.
- Removed manual variable expansion on left-hand side of `STREQUAL`,
`MATCHES` and `IN_LIST` where I was confident it was unintended.
Fixes #65028.
34 lines
1.5 KiB
CMake
34 lines
1.5 KiB
CMake
set(framework "FrameworkABIBaseline")
|
|
swift_install_in_component(PROGRAMS "swift-api-checker.py"
|
|
DESTINATION "bin"
|
|
COMPONENT toolchain-tools)
|
|
swift_install_in_component(DIRECTORY "sdk-module-lists"
|
|
DESTINATION "bin"
|
|
COMPONENT toolchain-tools)
|
|
swift_install_in_component(DIRECTORY "${framework}"
|
|
DESTINATION "lib/swift"
|
|
COMPONENT toolchain-tools)
|
|
|
|
# Add symlink of FrameworkABIBaseline to the build dir. This ensures we can
|
|
# find the baseline data from the same relative path as if we are running the
|
|
# checker from the toolchain.
|
|
set(SWIFTLIB_DIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/swift")
|
|
set(dest "${SWIFTLIB_DIR}/${framework}")
|
|
set(source "${CMAKE_CURRENT_SOURCE_DIR}/${framework}")
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
set(CMAKE_SYMLINK_COMMAND copy)
|
|
else()
|
|
set(CMAKE_SYMLINK_COMMAND create_symlink)
|
|
endif()
|
|
add_custom_command(OUTPUT "${dest}"
|
|
DEPENDS "${source}"
|
|
COMMAND "${CMAKE_COMMAND}" "-E" "${CMAKE_SYMLINK_COMMAND}" "${source}" "${dest}"
|
|
COMMENT "Symlinking ABI checker baseline data to ${dest}")
|
|
add_custom_target("symlink_abi_checker_data" ALL
|
|
DEPENDS "${dest}"
|
|
COMMENT "Symlinking ABI checker baseline data to ${dest}")
|
|
if(TARGET swift-frontend)
|
|
add_dependencies(swift-frontend symlink_abi_checker_data)
|
|
endif()
|