CMakeLists.txt 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. cmake_minimum_required(VERSION 2.8.7)
  2. include(CheckCXXCompilerFlag)
  3. CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
  4. if(NOT COMPILER_SUPPORTS_CXX11)
  5. message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
  6. endif()
  7. # compile flags
  8. # set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-as-needed")
  9. # set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -O2")
  10. # set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -g")
  11. # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_REENTRANT -fPIC -Wall -Werror")
  12. set(CNSTREAM_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
  13. # message(STATUS "framework: CNSTREAM_ROOT_DIR = ${CNSTREAM_ROOT_DIR}")
  14. set(LIBRARY_OUTPUT_PATH ${CNSTREAM_ROOT_DIR}/lib)
  15. set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/)
  16. set(CMAKE_MODULE_PATH ${CNSTREAM_ROOT_DIR}/cmake)
  17. # ---[ rapidjson
  18. include_directories(${CNSTREAM_ROOT_DIR}/3rdparty/)
  19. include_directories(${CNSTREAM_ROOT_DIR}/3rdparty/httplib)
  20. include_directories(${CNSTREAM_ROOT_DIR}/framework/core/include)
  21. include_directories(${CNSTREAM_ROOT_DIR}/framework/request/include)
  22. aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/core/src core_srcs)
  23. aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/request/src request_srcs)
  24. add_library(gsd_core SHARED ${core_srcs} ${request_srcs})
  25. target_link_libraries(gsd_core dl pthread ${CNRT_LIBS} ${GFLAGS_LIBRARIES})