Xcode generator: All source files with duplicate names are recompiled after a cmake call
This only happens with the Xcode generator. If I have source files with the same filenames (say a.cpp
and sub/a.cpp
) each time cmake is called, they are recompiled even if no changes are made. I suspect that CMake's Xcode generator generates bad (duplicate?) GUID's for such files, and Xcode assumes they are new, different files, then automatically fixes the GUID problem, Calling cmake
again though, will "see" that the generated project has changed, and reinstate its bad GUIDs, forcing Xcode to do the previous thing again.
Repro steps:
- Have project with source files with the same name. Such a sample project is attached here: cmake-xcode-bug.zip. (even two is enough, but the same thing happens with a project with hundreds of files - the ones with the same name are recompiled after every call to cmake)
$ cmake -G"Xcode"
-
$ xcodebuild
- first build -
$ xcodebuild
- as expected nothing is compiled, as no changes were made -
$ cmake .
- nothing should be changed -
$ xcodebuild
- notice as all files with same names are pointlessly compiled again -
$ xcodebuild
- Xcode has "fixed" the problem, and, again nothing is compiled