CMake - combine multiple libraries into one
问题 Let's say I have executables A, B, C, and I have external libraries X, Y, Z SET(EXTERNAL_LIB X Y Z) TARGET_LINK_LIBRARIES(A, ${EXTERNAL_LIB}) TARGET_LINK_LIBRARIES(B, ${EXTERNAL_LIB}) TARGET_LINK_LIBRARIES(C, ${EXTERNAL_LIB}) However, if I visualize this (using cmake --graphviz option, I get a complex bipartite graph with edges from each of the executables A, B, and C to each of the libraries X, Y, and Z. I was wondering if there's a way to combine all the libraries into one. 回答1: All of this