cmake文件【CMakeLists.txt】中获取操作系统信息:
MESSAGE(STATUS "platform: ${CMAKE_SYSTEM_NAME}") if (UNIX AND NOT APPLE) MESSAGE(STATUS "unix") elseif (WIN32) MESSAGE(STATUS "windows") elseif (APPLE) MESSAGE(STATUS "mac os") else () MESSAGE(STATUS "other platform") endif ()
查看mac上dylib依赖关系:otool -L ./xxx_lib_or_exec
查看mac上dylib依赖更详细信息:otool -l ./xxx_lib_or_exec
查看linux上so依赖关系:ldd ./xxx_lib_or_exec
精简linux上so大小:strip ./xxx_lib_or_exec