<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 3, 2013 at 4:33 PM, Bin Chen <span dir="ltr"><<a href="mailto:Bin.Chen@dts.com" target="_blank">Bin.Chen@dts.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">David,</span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">CMake generator works fine. In Xcode, I got this error when I click build.</span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></p>
<p class="" style="margin-left:12pt">
<span style="font-size:11pt;font-family:Menlo-Regular">Ld /Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug/t normal x86_64</span></p>
<p class="" style="margin-left:12pt">
<span style="font-size:11pt;font-family:Menlo-Regular"> cd /Users/bchen/share/temp/cmake-obj-lib/src</span></p>
<p class="" style="margin-left:12pt">
<span style="font-size:11pt;font-family:Menlo-Regular"> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -L/Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug -F/Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug
-filelist /Users/bchen/share/temp/cmake-obj-lib/b-xcode/test.build/Debug/t.build/Objects-normal/x86_64/t.LinkFileList -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug/liba.a /Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug/libb.a
-o /Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug/t</span></p>
<p class="" style="margin-left:12pt">
<span style="font-size:11pt;font-family:Menlo-Regular"> </span></p>
<p class="" style="margin-left:12pt">
<span style="font-size:11pt;font-family:Menlo-Regular">clang: error: no such file or directory: '/Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug/liba.a'</span></p>
<p class="" style="margin-left:12pt">
<span style="font-size:11pt;font-family:Menlo-Regular">clang: error: no such file or directory: '/Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug/libb.a'</span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Searched the build tree, it generated two libs with _obj.</span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">./test.build/Debug/a_obj.build/Objects-normal/liba_obj.a</span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">./test.build/Debug/b_obj.build/Objects-normal/libb_obj.a</span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks!</span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Best regards,</span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Bin Chen</span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></p>
<p class=""><b><span style="font-size:10pt;font-family:Tahoma,sans-serif">From:</span></b><span style="font-size:10pt;font-family:Tahoma,sans-serif"> David Cole [mailto:<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>]
<br>
<b>Sent:</b> Thursday, January 03, 2013 1:26 PM<br>
<b>To:</b> Bin Chen<br>
<b>Cc:</b> <a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a><br>
<b>Subject:</b> Re: [CMake] Object library doesn't work with CMake 2.8.10.2 Xcode generator</span></p><div><div class="h5">
<p class=""> </p>
<div>
<p class="">We have a test of OBJECT_LIBRARY that does work on all our dashboards, including ones running with Xcode.</p>
<div>
<p class=""> </p>
</div>
<div>
<p class="">When you say "it doesn't work" -- what do you mean? Do you get some error output?</p>
</div>
</div>
<div>
<p class="" style="margin-bottom:12pt"> </p>
<div>
<p class="">On Thu, Jan 3, 2013 at 3:56 PM, Bin Chen <<a href="mailto:Bin.Chen@dts.com" target="_blank">Bin.Chen@dts.com</a>> wrote:</p>
<div>
<div>
<p class="">Following CMakeLists.txt doesn’t work with Xcode (4.5.2). Is there anyone experienced the same? Thanks!</p>
<p class="">Visual Studio 10 and Linux makefile works fine. </p>
<p class=""> </p>
<p class="">cmake_minimum_required ( VERSION 2.8.8 )</p>
<p class=""> </p>
<p class="">project( test )</p>
<p class=""> </p>
<p class="">add_library( a_obj OBJECT t1.c t2.c )</p>
<p class="">add_library( b_obj OBJECT t3.c t4.c )</p>
<p class=""> </p>
<p class="">add_library( a $<TARGET_OBJECTS:a_obj> )</p>
<p class="">add_library( b $<TARGET_OBJECTS:b_obj> )</p>
<p class=""> </p>
<p class="">add_executable( t t.c )</p>
<p class="">target_link_libraries( t a b )</p>
<p class=""> </p>
<p class=""> </p>
<p class="">::::::::::::::</p>
<p class="">t.c</p>
<p class="">::::::::::::::</p>
<p class="">#include <stdio.h></p>
<p class=""> </p>
<p class="">int func1( int a );</p>
<p class="">int func2( int a );</p>
<p class="">int func3( int a );</p>
<p class="">int func4( int a );</p>
<p class=""> </p>
<p class="">int main()</p>
<p class="">{</p>
<p class=""> int a = 100;</p>
<p class=""> printf( "%d %d %d %d %d\n", a, func1(a), func2(a), func3(a), func4(a) );</p>
<p class=""> return 0;</p>
<p class="">}</p>
<p class="">::::::::::::::</p>
<p class="">t1.c</p>
<p class="">::::::::::::::</p>
<p class="">int func1( int a )</p>
<p class="">{</p>
<p class=""> return a*1;</p>
<p class="">}</p>
<p class="">::::::::::::::</p>
<p class="">t2.c</p>
<p class="">::::::::::::::</p>
<p class="">int func2( int a )</p>
<p class="">{</p>
<p class=""> return a*2;</p>
<p class="">}</p>
<p class="">::::::::::::::</p>
<p class="">t3.c</p>
<p class="">::::::::::::::</p>
<p class="">int func3( int a )</p>
<p class="">{</p>
<p class=""> return a*3;</p>
<p class="">}</p>
<p class="">::::::::::::::</p>
<p class="">t4.c</p>
<p class="">::::::::::::::</p>
<p class="">int func4( int a )</p>
<p class="">{</p>
<p class=""> return a*4;</p>
<p class="">}</p>
<p class=""> </p>
<p class="">Best regards,</p>
<p class="">Bin Chen</p>
<p class=""> </p>
</div>
<p class=""> </p>
<div class="" align="center" style="text-align:center">
<hr size="2" width="100%" align="center">
</div>
<p class=""><span style="font-family:'Courier New'"><br>
Notice:<br>
This message and any included attachments are intended only for the use of the addressee, and may contain information that is privileged or confidential. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have received this communication in error, please destroy the original message and any copies or printouts hereof.<br>
</span><br clear="all">
</p>
</div>
<p class=""><br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">
http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a></p>
</div>
<p class=""> </p>
</div>
</div></div></div><div><div class="h5">
<br>
<hr>
<font face="Courier New" color="Black" size="3"><br>
Notice:<br>
This message and any included attachments are intended only for the use of the addressee, and may contain information that is privileged or confidential. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have received this communication in error, please destroy the original message and any copies or printouts hereof.<br>
</font>
<br clear="all">
</div></div></div>
</blockquote></div><br></div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>I had misread/misunderstood your original post.</div><div class="gmail_extra" style><br></div><div class="gmail_extra">
<br></div><div class="gmail_extra" style>Instead of this:</div><div class="gmail_extra" style><p class="" style="color:rgb(80,0,80)">add_library( a $<TARGET_OBJECTS:a_obj> )</p><p class="" style="color:rgb(80,0,80)">
add_library( b $<TARGET_OBJECTS:b_obj> )</p><p class="" style="color:rgb(80,0,80)">add_executable( t t.c )</p><p class="" style="color:rgb(80,0,80)"><br></p><p class="" style="color:rgb(80,0,80)">Just write this:</p>
<p class="" style="color:rgb(80,0,80)"></p><p class="">add_executable( t t.c $<TARGET_OBJECTS:a_obj> $<TARGET_OBJECTS:b_obj>)<br></p><p class=""><br></p><p class="" style>Why do you try to put the objects from an OBJECT library into another library? Just use them directly in your executable...</p>
<p class="" style><br></p><p class="" style>HTH,</p><p class="" style>David</p><p class="" style><br></p><p></p></div></div>