swiftlang / swift-foundation

The Foundation project
Apache License 2.0
2.4k stars 159 forks source link

Fix macro source location #910

Closed etcwilde closed 2 months ago

etcwilde commented 2 months ago

When a project is used through a FetchContent/add_subdirectory, the CMAKE_SOURCE_DIR path points to the calling project. This is resulting in some of the CI jobs attempting to FetchContent the macros from swift-corelibs-foundation/Sources/FoundationMacros, rather than swift-foundation/Sources/FoundationMacros, ultimately failing the build.

The project call sets a ${CMAKE_PROJECT_NAME}_SOURCE_DIR variable to the source directory of the project itself, making it more reliable. CMAKE_CURRENT_SOURCE_DIR would also work here too.

Noticed in: https://ci.swift.org/view/all/job/swift-build-static-sdk/46

etcwilde commented 2 months ago

@swift-ci please test