mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Adding the Glibc Clang Overlay interface target to the installed export set. The interface library exists to plumb the appropriate flags through the build graph and ensure that the modulemap and header file are generated when depended on. Interface libraries need to be in the export set when depended on by a public library to ensure that the appropriate install interface flags are exposed to targets importing the library from outside of the build system, regardless of whether the interface library actually installs any files. This fixes the configuration-time error: Export called with target "swiftGlibc" which requires "SwiftGlibcClangOverlay" that is not in any export set.
39 lines
1.1 KiB
CMake
39 lines
1.1 KiB
CMake
gyb_expand(glibc.modulemap.gyb glibc.modulemap
|
|
FLAGS -DCMAKE_SDK="LINUX")
|
|
gyb_expand(SwiftGlibc.h.gyb SwiftGlibc.h)
|
|
|
|
file(CONFIGURE
|
|
OUTPUT glibc-overlay.yml
|
|
CONTENT [==[
|
|
---
|
|
version: 0
|
|
case-sensitive: false
|
|
use-external-names: false
|
|
roots:
|
|
- name: "/usr/include"
|
|
type: directory
|
|
contents:
|
|
- name: module.modulemap
|
|
type: file
|
|
external-contents: "@CMAKE_CURRENT_BINARY_DIR@/glibc.modulemap"
|
|
- name: SwiftGlibc.h
|
|
type: file
|
|
external-contents: "@CMAKE_CURRENT_BINARY_DIR@/SwiftGlibc.h"
|
|
]==]
|
|
ESCAPE_QUOTES @ONLY NEWLINE_STYLE LF)
|
|
|
|
add_library(SwiftGlibcClangOverlay INTERFACE
|
|
SwiftGlibc.h
|
|
glibc.modulemap)
|
|
target_compile_options(SwiftGlibcClangOverlay INTERFACE
|
|
"$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:Swift>:SHELL:-vfsoverlay ${CMAKE_CURRENT_BINARY_DIR}/glibc-overlay.yml>>")
|
|
|
|
install(TARGETS SwiftGlibcClangOverlay EXPORT SwiftOverlayTargets)
|
|
|
|
install(
|
|
FILES
|
|
"${CMAKE_CURRENT_BINARY_DIR}/glibc.modulemap"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/SwiftGlibc.h"
|
|
DESTINATION
|
|
"${CMAKE_INSTALL_LIBDIR}/swift/${SwiftOverlay_PLATFORM_SUBDIR}/${SwiftOverlay_ARCH_SUBDIR}")
|