[Xcode 10.1, MacOS 10.14.1]
I have a project that uses bmake
(could be any make
though) and the Makefile provides a number of targets. I would like to use Xcode to build host
and clean the build folder, but I'm having trouble working out how configure Xcode to allow me to this.
From the command line, I would build using bmake host
and clean using bmake clean
. The reason I'm using Xcode for this is because I like to use an IDE for debugging.
In Project -> Info (External Build Tool Configuration)
, I have:
Build Tool : /usr/local/bin/bmake
Arguments : host
Directory : None <- I'm using the current path
With these settings, Product -> Build
builds my target, but Product -> Clean Build Folder
does nothing even though Xcode reports that the clean succeeded.
In order to actually do a clean, I either need to define another target with the Arguments
field set to clean
and then switch between targets when building/cleaning, or, use a single target and change the argument field depending on whether I'm building or cleaning. (A really clumsy way of going about it.)
If I leave Arguments
with it's default value $(ACTION)
all targets get built (except clean), and cleaning does nothing useful.
I've read https://stackoverflow.com/questions/15652316/setup-xcode-for-using-external-compiler but that question does not address this problem.
Is there a better way of doing this?
Best Answer
The approach we are using:
CMakeStatus.txt
) toBUILT_PRODUCTS_DIR
, which will be used as a flag indicating that Xcode did clean.CMakeStatus.txt
is present or not. If not, then rebuild your external build system.Here is example of using Cmake and rebuilding it if Xcode did a clean.