Re: [CMake] Building library with a collection of source + pre-existing object files (which are not compiled via the cmake build system)
On 09.09.2014 17:02, Tom Kacvinsky wrote: Hi, I have not been able to find this in the cmake documentation. I have a collection of source that needs to be compiled via the cmake build system, plus a collection of object files that were compiled outside the cmake build system. I want to combine the two of these to make a shared library, but apparently add_library only takes a list of source files. Is there a way of getting cmake to build a shared library with the collection of source and object files I have? I know I could make an archive of the object files and use that library in target_link_libraries, but I would like to avoid this if I can. You should be able to list your object files like regular source files. If they have known object file extensions they should be detected as such (.obj, .o, .lo). Otherwise you can try setting the EXTERNAL_OBJECT[1] source file property for them. Nils [1] www.cmake.org/cmake/help/v3.0/prop_sf/EXTERNAL_OBJECT.html -- 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
Re: [CMake] Building library with a collection of source + pre-existing object files (which are not compiled via the cmake build system)
Thank you, Nils. Tom On Tue, Sep 9, 2014 at 11:25 AM, Nils Gladitz nilsglad...@gmail.com wrote: On 09.09.2014 17:02, Tom Kacvinsky wrote: Hi, I have not been able to find this in the cmake documentation. I have a collection of source that needs to be compiled via the cmake build system, plus a collection of object files that were compiled outside the cmake build system. I want to combine the two of these to make a shared library, but apparently add_library only takes a list of source files. Is there a way of getting cmake to build a shared library with the collection of source and object files I have? I know I could make an archive of the object files and use that library in target_link_libraries, but I would like to avoid this if I can. You should be able to list your object files like regular source files. If they have known object file extensions they should be detected as such (.obj, .o, .lo). Otherwise you can try setting the EXTERNAL_OBJECT[1] source file property for them. Nils [1] www.cmake.org/cmake/help/v3.0/prop_sf/EXTERNAL_OBJECT.html -- 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