[cmake-developers] Referencing all sources in compile command

Ben Boeckel ben.boeckel at kitware.com
Mon Dec 31 17:17:21 EST 2018


On Sun, Dec 30, 2018 at 13:09:23 -0800, Saleem Abdulrasool wrote:
> I was looking at supporting Swift as a language in CMake.  I know that
> CMake has some preliminary support that assumes that you are building on
> macOS with Xcode.  I am trying to support building swift libraries and
> executables on Linux and Windows.

IIRC, the issue before was that the command line interface to swiftc was
basically treated as a black box and not stable (i.e., whatever Xcode
wanted drove the interface, backwards compat was not guaranteed). Is
that different now?

> There is some preliminary work on this that I have put up on GitHub [1].
> One place that I am hitting a roadblock in is the need to reference all the
> target sources in the compile rule for a single object.  AFAICT, there is
> no placeholder that will expand to the target sources.  Would it be
> acceptable to add a `<TARGET_SOURCES>` place holder?  Or is there another
> approach that would be better?

The problem with that is that per-source file properties cannot be
applied (compile definitions, flags, etc.). I don't know whether or not
this is important for Swift.

Other questions which spring to mind:

  - Does it support making just the compile artifacts from the source
    files or does it always do the link step?
  - If the latter, how do mixed language libraries work?
  - Also, if linking is done by Swift, how would one add a manifest or
    .rc file on Windows (e.g., to get an application icon)?

The list of restrictions would need to be well-defined here first I
think.

--Ben


More information about the cmake-developers mailing list