using cmake to link object files into lib.xxxx.a file

送分小仙女□ 提交于 2020-01-06 04:33:20

问题


I've got a list of object files that I want to package in a library. How do I do this? I thought I could use ADD_LIBRARY


回答1:


add_library is the correct answer. To make a static library, you want to do something like this:

add_library(foo STATIC foo.c bar.c baz.c)



回答2:


Static libraries are becoming a bit obsolete, but "ar" is the command you are looking for.



来源:https://stackoverflow.com/questions/3974415/using-cmake-to-link-object-files-into-lib-xxxx-a-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!