Hi David,

I created a bug report (http://public.kitware.com/Bug/view.php?id=11896).  It 
has an attached tar-file with a sample project that reproduces the problem.

Thanks,
Shash


---
The contents of this email and any attachments are confidential.  They 
are intended for the named recipient(s) only.

If you have received this email in error please notify the sender 
immediately.  Please do not disclose the contents to anyone else.  
Please do not make copies of the contents or any attachments.  Thank 
you for your cooperation.
---



-----Original Message-----
From: David Cole [mailto:david.c...@kitware.com] 
Sent: Thursday, February 17, 2011 3:40 PM
To: Chatterjee, Shash
Subject: Re: [CMake] Including an external object file (.o) into static shared 
library using MS Visual Studio generator

Create a bug report if you can attach an example project that
demonstrates the issue.


On Thu, Feb 17, 2011 at 4:32 PM, Chatterjee, Shash
<schatter...@camber.com> wrote:
> Hi David,
>
> There are way too many build files to add it to each executable, even inside 
> our system.  To make matters worse, all our customer builds would break as 
> well, not an option!
>
> In a prior email, I sent you a rss.vcxproj file that works.  If you search 
> for "kfunc.obj", you will see what makes it work.
>
> I do understand your time pressure, and can live with manually adding it to 
> the VS project until it is fixed.  Should I create a bug report for this?
>
> Thanks again for your help,
> Shash
>
> -----Original Message-----
> From: David Cole [mailto:david.c...@kitware.com]
> Sent: Thursday, February 17, 2011 3:25 PM
> To: Chatterjee, Shash
> Subject: Re: [CMake] Including an external object file (.o) into static 
> shared library using MS Visual Studio generator
>
> Actually, I don't know if you can include a *.obj in a *static*
> library this way. I'd have to experiment and/or do some research. I
> don't have time for either in the next few days, though...
>
> Why can't you add it to the executables that need it?
>
>
> On Thu, Feb 17, 2011 at 4:22 PM, David Cole <david.c...@kitware.com> wrote:
>> And what is the build error that you're seeing?
>>
>>
>> On Thu, Feb 17, 2011 at 4:21 PM, Chatterjee, Shash
>> <schatter...@camber.com> wrote:
>>> Yes, I tried the .obj with 2.8.4, and it made the difference from 
>>> <ClInclude> to <None>, but that's it.
>>>
>>>
>>> ---
>>> The contents of this email and any attachments are confidential.  They
>>> are intended for the named recipient(s) only.
>>>
>>> If you have received this email in error please notify the sender
>>> immediately.  Please do not disclose the contents to anyone else.
>>> Please do not make copies of the contents or any attachments.  Thank
>>> you for your cooperation.
>>> ---
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: David Cole [mailto:david.c...@kitware.com]
>>> Sent: Thursday, February 17, 2011 3:18 PM
>>> To: Chatterjee, Shash
>>> Subject: Re: [CMake] Including an external object file (.o) into static 
>>> shared library using MS Visual Studio generator
>>>
>>> Did you try using "kfunc.obj" instead of "kfunc.o" with CMake 2.8.4?
>>>
>>>
>>> On Thu, Feb 17, 2011 at 3:31 PM, Chatterjee, Shash
>>> <schatter...@camber.com> wrote:
>>>> The difference in the vcxproj file is that instead of the <ClInclude> 
>>>> element, it creates a new <ItemGroup> and sticks a <None> element with the 
>>>> .obj.  In VS10, previously kfunc.o (with ClInclude) had an icon for an 
>>>> unknown type, now it has a specific icon.  However, it still does not add 
>>>> to the library.
>>>>
>>>> I have attached the CMake-generated vcxproj: rss-does-not-work.vcxproj
>>>> I have attached the vcxproj after I manually added: rss.vcxproj
>>>>
>>>> -----Original Message-----
>>>> From: David Cole [mailto:david.c...@kitware.com]
>>>> Sent: Thursday, February 17, 2011 1:41 PM
>>>> To: Chatterjee, Shash
>>>> Subject: Re: [CMake] Including an external object file (.o) into static 
>>>> shared library using MS Visual Studio generator
>>>>
>>>> If you copy it to a file name ending with ".obj" does it work?
>>>>
>>>> 2011/2/17 Chatterjee, Shash <schatter...@camber.com>:
>>>>> Hi David,
>>>>>
>>>>> Just sending to you directly since it might not be a good idea to post 
>>>>> this publicly. Hopefully, this is OK with you.
>>>>>
>>>>> Thanks,
>>>>> Shash
>>>>>
>>>>>
>>>>> ---
>>>>> The contents of this email and any attachments are confidential.  They
>>>>> are intended for the named recipient(s) only.
>>>>>
>>>>> If you have received this email in error please notify the sender
>>>>> immediately.  Please do not disclose the contents to anyone else.
>>>>> Please do not make copies of the contents or any attachments.  Thank
>>>>> you for your cooperation.
>>>>> ---
>>>>>
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: David Cole [mailto:david.c...@kitware.com]
>>>>> Sent: Thursday, February 17, 2011 1:23 PM
>>>>> To: Chatterjee, Shash
>>>>> Cc: cmake@cmake.org
>>>>> Subject: Re: [CMake] Including an external object file (.o) into static 
>>>>> shared library using MS Visual Studio generator
>>>>>
>>>>> Can you send your CMakeLists.txt file? Or at least copy/paste the
>>>>> relevant portion of it so we can see how you're adding the file?
>>>>>
>>>>> Actually, maybe you won't need to send us code...
>>>>>
>>>>> It needs to be a "*.obj" file to work with the Visual Studio
>>>>> generators. We use the file extension ".obj" to identify them as
>>>>> object files.
>>>>>
>>>>> If you copy it to a file name ending with ".obj" does it work?
>>>>>
>>>>>
>>>>> On Thu, Feb 17, 2011 at 2:18 PM, Chatterjee, Shash
>>>>> <schatter...@camber.com> wrote:
>>>>>> Hi David,
>>>>>>
>>>>>> I truly appreciate your willingness to help, and your prompt response.  
>>>>>> Thanks a bunch!
>>>>>>
>>>>>> I just installed 2.8.4 and tried again.  As far as I can tell, the 
>>>>>> behavior did not change (I deleted the CMake-2.8.3 generated build 
>>>>>> directory, as well as uninstalling CMake-2.8.3).  I still see the 
>>>>>> <ClInstall> element for the .o file, and it does not get included in the 
>>>>>> library.
>>>>>>
>>>>>> Thanks,
>>>>>> Shash
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: David Cole [mailto:david.c...@kitware.com]
>>>>>> Sent: Thursday, February 17, 2011 12:23 PM
>>>>>> To: Chatterjee, Shash
>>>>>> Cc: cmake@cmake.org
>>>>>> Subject: Re: [CMake] Including an external object file (.o) into static 
>>>>>> shared library using MS Visual Studio generator
>>>>>>
>>>>>> This was a known bug, and has been fixed in CMake 2.8.4.
>>>>>>
>>>>>> See here for details if you want:
>>>>>> http://public.kitware.com/Bug/view.php?id=11459
>>>>>>
>>>>>> Upgrade to CMake 2.8.4 and try again. Should work....
>>>>>>
>>>>>>
>>>>>> Cheers,
>>>>>> David
>>>>>>
>>>>>>
>>>>>> On Thu, Feb 17, 2011 at 12:59 PM, Chatterjee, Shash
>>>>>> <schatter...@camber.com> wrote:
>>>>>>> Hi!
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I need to include a 3rd-party API, which comes without source, as an 
>>>>>>> object
>>>>>>> (.o) file into a static library using CMake 2.8.3.  I know it is 
>>>>>>> possible to
>>>>>>> add the .o when executables are linked, but that is not the preferred
>>>>>>> method.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I have simply defined the .o file in the ADD_LIBRARY command.  This 
>>>>>>> works
>>>>>>> under linux, and nmake (MS Visual Studio 10 /2010).  If I look in the
>>>>>>> cmake-generated build.make, CMake correctly recognizes the .o as an 
>>>>>>> external
>>>>>>> dependency and defines a <libname>_EXTERNAL_OBJECTS variable in there, 
>>>>>>> and
>>>>>>> it is listed at the tail end of objects1.rsp.  So far, so good!
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> When using the "Visual Studio 10" generator, CMake adds the object file 
>>>>>>> as a
>>>>>>> <ClInclude Include="....."/> XML element under a <ItemGroup> element 
>>>>>>> that also
>>>>>>> lists all the source files as <ClCompile> elements for the static 
>>>>>>> library
>>>>>>> project.  Of course the .o is not include in the lib when the project is
>>>>>>> built.  I can manually go into the project properties, and add it as an
>>>>>>> "Additional Dependencies" dependency for the Librarian, and that 
>>>>>>> works.  Is
>>>>>>> there a way to get CMake to do this automatically?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Shash
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Powered by www.kitware.com
>>>>>>>
>>>>>>> Visit other Kitware open-source projects at
>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>
>>>>>>> Please keep messages on-topic and check the CMake FAQ at:
>>>>>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>>>>>
>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

<<attachment: Sasvata (Shash) Chatterjee.vcf>>

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to