Xcode how to exclude FOLDERS from compilation?

Can't comment, but wanted to note that, unless I'm doing something wrong, when using the EXCLUDED_SOURCE_FILE_NAMES build setting as explained in the other answered, excluding a folder using something like */Folder/* won't exclude anything within sub-folders of Folder, but only files within it directly. If you had another folder, eg. /Folder/Subfolder/, you'd have to include */Folder/Subfolder/* as well in order to exclude any files within it. At least this is the case in Xcode 10.3.

Example:

[Folder]
    item.txt
    [Subfolder]
        image.png
    info.plist

*/Folder/* would exclude item.txt and info.plist, but not image.png.

*/Folder/Subfolder/* would exclude image.png.


xcode 9.2

Build Settings> Build Options> Excluded Source File Names

enter image description here


From looking at the post you link to. Here is how you do it:

  1. Go to Build Settings.

  2. Press the plus button and select "Add User-Defined settings"

enter image description here

  1. Give the new field the name of EXCLUDED_SOURCE_FILE_NAMES.

enter image description here

  1. Add the path to the folder: <Path>/FolderToIgnore/*. The asterisk denotes all the file in the folder.

enter image description here

That should do it.

Note: Make sure you add this to the right target.