From fbaa8f5472d35cbd1ea2bc3104f5570c69d47cf2 Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Mon, 9 Sep 2024 11:58:41 -0700 Subject: [PATCH] Fix macro source location 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. --- Sources/FoundationEssentials/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/FoundationEssentials/CMakeLists.txt b/Sources/FoundationEssentials/CMakeLists.txt index 235e258a4..25cae88a4 100644 --- a/Sources/FoundationEssentials/CMakeLists.txt +++ b/Sources/FoundationEssentials/CMakeLists.txt @@ -59,7 +59,7 @@ else() # No path to Foundation macros was provided, so we must build it ourselves set(FoundationMacros_BuildLocalExecutable YES) FetchContent_Declare(FoundationMacros - SOURCE_DIR ${CMAKE_SOURCE_DIR}/Sources/FoundationMacros) + SOURCE_DIR ${SwiftFoundation_SOURCE_DIR}/Sources/FoundationMacros) FetchContent_MakeAvailable(FoundationMacros) add_dependencies(FoundationEssentials FoundationMacros) get_target_property(MacroDIR FoundationMacros RUNTIME_OUTPUT_DIRECTORY)