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 > _______________________________________________ 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