Skip to content

Xcode: Fix GetObjectsNormalDirectory to work with sanitizers

james-howard requested to merge james-howard/cmake:Fix16289 into master

When building a target that includes an Object Library using the Xcode Generator, CMake sets OTHER_LIBTOOLFLAGS on the target in the Xcode project to the list of the object files in the Object Library.

So if the Object Library contains sources foo.c and bar.c, then the OTHER_LIBTOOLFLAGS would contain foo.o and bar.o. It previously assumed that these files would live /path/to/.build/Objects-normal/, but when building with one of the sanitizers (e.g. Address Sanitizer, Thread Sanitizer, etc), Xcode actually puts these .o files at /path/to/.build/Objects-normal-asan/. Xcode provides an $(OBJECT_FILE_DIR_normal) variable that we can use along with the :base modifier to get just the "Objects-normal-asan" part of the path that we need to build the correct path to the .o files.

Fixes: #16289 (closed)
Topic-rename: xcode-object-dir

Edited by Brad King

Merge request reports