Package `swift build` compiles, but Xcode fails when using cSettings

Hey, I'm seeing a very weird issue with the package manager

Basically, I'm using glew.h, which is known to have issues with modules. I figured that part out, but for some reason it only works when building and running from the terminal now.

this is my package.swift:

// swift-tools-version: 5.7

import PackageDescription

let package = Package(
    name: "TestEngine",
    products: [
        .executable(name: "TestEngine", targets: ["TestEngine"])
    dependencies: [],
    targets: [
            name: "TestEngine",
            dependencies: ["SDL2", "GLEW"],
            resources: [
            cSettings: [
        .systemLibrary(name: "SDL2", pkgConfig: "sdl2"),
        .systemLibrary(name: "GLEW", pkgConfig: "glew"),
            name: "TestEngineTests",
            dependencies: ["TestEngine"]),

And this is the umbrella header for glew:

#include "/opt/homebrew/include/GL/glew.h"
#include <OpenGL/gl.h>

The c flag "-DGLEW_NO_GLU" fixes the module problem, and everything compiles from Terminal.

however Xcode gives me this:
Command SwiftCompile failed with a nonzero exit code

I'm not sure what is happening here.

by the way, it seems like the flag doesn't work at all when using Xcode, since after a few tries Xcode gives me the errors I would get without the flag in the first place