环境:Linux CMake
修改CMakeLists.txt
同时将模块编译生成动态库和静态库的方法:
ADD_LIBRARY(nyutil SHARED ${SRC_LIST})
ADD_LIBRARY(nyutil_static STATIC ${SRC_LIST})
SET_TARGET_PROPERTIES(nyutil_static PROPERTIES OUTPUT_NAME "nyutil")
SET_TARGET_PROPERTIES(nyutil PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(nyutil_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
将模块同时编译生成.a和.so
转载于:https://blog.51cto.com/evely/1864456