CMakeLists.txt 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. cmake_minimum_required(VERSION 2.8.7)
  2. if(POLICY CMP0046)
  3. cmake_policy(SET CMP0046 NEW)
  4. endif()
  5. if(POLICY CMP0054)
  6. cmake_policy(SET CMP0054 NEW)
  7. endif()
  8. # compile flags
  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 -Wno-deprecated-declarations -Wall -Werror")
  12. set(CNSTREAM_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
  13. set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../bin/)
  14. # ---[ rapidjson
  15. include_directories(${CNSTREAM_ROOT_DIR}/3rdparty/rapidjson/include)
  16. # ---[ add target
  17. include(${CNSTREAM_ROOT_DIR}/cmake/have_cnstream_target.cmake)
  18. have_framework_target(${CNSTREAM_ROOT_DIR})
  19. have_modules_target(${CNSTREAM_ROOT_DIR})
  20. have_modules_contrib_target(${CNSTREAM_ROOT_DIR})
  21. set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed")
  22. add_executable(cnstream_inspect cnstream_inspect.cpp)
  23. if(HAVE_FRAMEWORK_TARGET)
  24. add_dependencies(cnstream_inspect cnstream_core)
  25. endif()
  26. if(HAVE_MODULES_TARGET)
  27. add_dependencies(cnstream_inspect cnstream_va)
  28. endif()
  29. if(HAVE_MODULES_CONTRIB_TARGET)
  30. add_dependencies(cnstream_inspect cnstream_contrib)
  31. endif()
  32. if(HAVE_MODULES_CONTRIB)
  33. target_link_libraries(cnstream_inspect cnstream_contrib)
  34. endif()
  35. target_link_libraries(cnstream_inspect cnstream_va cnstream_core pthread dl)