123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- cmake_minimum_required(VERSION 2.8.3)
- project(space_lib)
- add_compile_options(-std=c++11)
- set (CMAKE_BUILD_TYPE Release)
- find_package(Boost REQUIRED COMPONENTS system thread)
- include_directories(
- include
- /usr/include
- /usr/local/include
- ${Boost_INCLUDE_DIRS}
- )
- link_directories(
- # lib/glog
- # lib/gflags
- lib/uuid
- /usr/lib/
- /usr/local/lib/
- /usr/local/libstatic/
- )
- # 源文件
- SET(SPACE_LIB_SRC
- # algorithm
- src/algorithm/bezier.cpp
- src/algorithm/fold.cpp
- # comm
- src/comm/ctcp/ctcp.cpp
- src/comm/serial/serial.cpp
- src/comm/tcp/tcp.cpp
- src/comm/udp/udp.cpp
- src/comm/websocket/websocket.cpp
- # common
- src/common/directory.cpp
- src/common/home.cpp
- src/common/time.cpp
- src/common/uuid.cpp
- src/common/lookup_table.cpp
- # config
- src/config/config.cpp
- # error
- src/error/error.cpp
- # json
- src/json/json_reader.cpp
- src/json/json_value.cpp
- src/json/json_writer.cpp
- src/json/json.cpp
- # log
- src/log/log.cpp
- # string
- src/string/string_to.cpp
- src/string/to_string.cpp
- )
- # 库文件
- SET(SPACE_LIB_LIB
- # glog gflags
- # libglog.a
- # libgflags.a
- # uuid
- libuuid.a
- )
- # 添加动态库
- add_library(space_lib SHARED
- ${SPACE_LIB_SRC}
- )
- # 动态库连接库
- target_link_libraries(space_lib
- ${Boost_LIBRARIES}
- ${SPACE_LIB_LIB}
- glog
- )
- # 生成动态库的版本号
- SET_TARGET_PROPERTIES(space_lib PROPERTIES VERSION 1.0.5)
- # 添加静态库
- add_library(space_lib_static STATIC
- ${SPACE_LIB_SRC}
- )
- # 静态库连接库
- target_link_libraries(space_lib_static
- ${Boost_LIBRARIES}
- ${SPACE_LIB_LIB}
- glog
- )
- # 静态库重新命
- SET_TARGET_PROPERTIES(space_lib_static PROPERTIES OUTPUT_NAME "space_lib")
- # 安装库
- INSTALL(TARGETS space_lib space_lib_static
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION libstatic
- )
- # 安装头文件
- INSTALL(DIRECTORY include/space_lib
- DESTINATION include
- )
- # 安装头文件
- INSTALL(DIRECTORY include/websocketpp
- DESTINATION include
- )
|