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

Reply via email to