Copy out plain .o files with cmake
问题 I'm trying to get cmake (on linux) to create some static object (.o) files and install them to an external directory. To that end I have a list, object_sources , containing the project path of the sources, and put this in the top level CMakeLists.txt : set(local_objects "") foreach(file ${object_sources}) get_filename_component(cur ${file} NAME_WE) add_library("${cur}.o" OBJECT ${file}) list(APPEND local_objects "${cur}.o") # To confirm these variables are what I think they are: message("--->