If I add a single C++ source file from my C++ codebase to my XCode project via "Compile Sources" build phase, that file is included in the build and all looks good.

However, I have a bunch of source files in my existing C++ codebase tree and I'd rather not add them all manually.

I can add the whole C++ codebase directory in "Compile Sources" directory, but then XCode asks me to "Create external build system project". If I do that (and add the resulting target as a dependency to the main target), no C++ files get compiled . Presumably because of a missing Makefile for my codebase ?

So. Do I have to make my own Makefile? If so, that's OK. I have my own GNU makefile for Linux. But what are the compiler arguments, who does the linking, ... ? Is there a makefile template for this type of situation ?

It seems slightly mad to write a Makefile for use within XCode, but is that my only option if I don't want to add a million source files directly to my Target's "Compile Sources" ?

Add the folder of C++ files to your project by choosing File > Add Files to ProjectName. In the Open panel you will see a Folders group with two radio buttons. Select the Create groups for any added folders radio buttons.

If adding the folder to the project doesn't add all the files to the Compile Sources build phase, click the + button to add them. You can select multiple files to add by shift-clicking and command-clicking so you don't have to add them one at a time. In your case, clicking the first file in your C++ file folder and shift-clicking the last file should select all of the files in the folder.