[CMake] Xcode duplicate filename issue?

Robert Maynard robert.maynard at kitware.com
Mon Jun 26 17:06:03 EDT 2017


IIRC the challenge is that CMake is not in control of specifying the
name of the object file that will be used for the XCode generator. So
when a project has multiple object files with the same source name
XCode adds an unknown unique id.

On Mon, Jun 26, 2017 at 4:58 PM, Watson, Andre <Andre_Watson at intuit.com> wrote:
> Hi Gregor, so I wrote a really minimal test case for this, and to my
> surprise, it worked!  My suspicion was now that my issue is caused from
> using object libraries in our system, because I need to create libs of libs
> for ease of CMake use.  I modified my test case and got the issue again.
> One of my coworkers also found this post from 2014 that is my exact issue:
> https://cmake.org/pipermail/cmake/2016-April/063169.html
>
>
> Let me know if you still want a bug report since this has been reported
> before.
>
>
> But for extra info, my case is slightly different than his:
>
>
> Directories:
>
> - CMakeLists.txt
>
> - empty.cpp
>
> - libdir
>
>     - CMakeLists.txt
>
>     - source.cpp
>
>     - subdir
>
>         - source.cpp
>
>
>
> Root CMakeLists:
>
> cmake_minimum_required(VERSION 3.6)
> project(Test)
>
> add_subdirectory(libdir)
>
> set( SOURCE
>     ./empty.cpp
> )
>
> add_library( ${PROJECT_NAME}
>     ${SOURCE}
>     $<TARGET_OBJECTS:libdir>
> )
>
>
>
> sub CMakeLists:
>
> cmake_minimum_required(VERSION 3.6)
> project(libdir)
>
> set( SOURCE
>     ./source.cpp
>     ./subdir/source.cpp
> )
>
> add_library( ${PROJECT_NAME} OBJECT
>     ${SOURCE}
> )
>
>
>
> source.cpp (1):
>
> int subdir(int x);
>
> int main()
> {
>     int i=subdir(5);
>     return 0;
> }
>
>
>
> source.cpp (2):
>
> int subdir(int x)
> {
>     int total = 0;
>
>     for( int i=0; i<x; i++)
>     {
>         total += x;
>     }
>
>     return total;
> }
>
>
>
> empty.cpp is empty
>
>
>
> Thank you!
>
> ________________________________
> From: Gregor Jasny <gjasny at googlemail.com>
> Sent: Monday, June 26, 2017 12:35:12 PM
> To: Watson, Andre; cmake at cmake.org
> Subject: Re: [CMake] Xcode duplicate filename issue?
>
> Hello,
>
> On 6/26/17 8:12 PM, Watson, Andre wrote:
>> We're currently migrating a huge internal system over to CMake, and we're
>> nearing completion, but have run into an issue with the generated Xcode
>> projects.  We build this system on Windows, Linux, and Mac (both makefile
>> and Xcode).  On all systems, we have a third party directory that has a
>> couple of duplicate source names within a single CMakeLists.txt file.  On
>> Windows, Linux, and makefile Mac, our projects all generate, build, and link
>> successfully.  However, on Xcode Mac, our project builds, but fails to link.
>> On further inspection, the duplicate filenames are being generated into the
>> intermediate build directories as filenames such as
>> attributes-78663048C12E97C.o and attributes-FA2B54357D684A6E.o.  The linker,
>> however, is looking for attributes.o.  It appears that the compiling process
>> is recognizing the duplicate naming and adding on the hex string (the non
>> duplicate .o's do not have these strings), but that these new filenames are
>> not being passed to the linker.  Is this is an Xcode option that I am
>> missing, or this something occurring within the CMake project generation
>> that is causing is mismatch?
>
> could you please try to create a minimal example and file a bug report?
> I'll have a look then.
>
> Thanks,
> Gregor
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list