Setting the Subsystem Type does not work via SPM

There is no proper way to set the subsystem via the linker flags.
In fact, the linker flags in SPM are completely broken.

When trying to set the Subsystem to Windows, in order for my application to have a starting Window, instead of the console, I realized that this isn't possible with SPM. I have a compiled .dll that contains a Window manager which creates a Windows via some methods. More specifically it is a wrapper for SDL. Unfortunately, I cannot have SPM instantiate it as easily. SPM assumes my project is a console app and starts the console window before my actual library code presents the user with another window. This is highly annoying as no one wants to have a useless console running in the background.

Here's the issue:
The Linker actually assumes that every link argument is a library, thus giving it the suffix .lib.

Part of the Package:

      linkerSettings: [
        .unsafeFlags(["-l/SUBSYSTEM:WINDOWS"])
      ]

The error I get:
lld-link: error: unknown subsystem: WINDOWS.lib

The behavior that you describe is correct and desired. -l indicates a request for a library to be linked. Setting the subsystem is possible; see build: improve GUI application handling for Swift 5.4 · compnerd/swift-win32-application@d3e5306 · GitHub for an explanation.