CMakeLists.txt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. if (NOT CNIS_WITH_CONTRIB)
  2. message(FATAL_ERROR "CNIS sample depend on cnis/contrib content, enable CNIS_WITH_CONTRIB to build samples!")
  3. endif()
  4. # ---[ OpenCV
  5. set(OpenCV_FIND_QUIETLY true)
  6. find_package(OpenCV OPTIONAL_COMPONENTS imgcodecs)
  7. set(imgcodecs_libs ${OpenCV_LIBS})
  8. find_package(OpenCV REQUIRED core imgproc highgui features2d)
  9. if (OpenCV_FOUND)
  10. message(STATUS "OpenCV Found")
  11. else (OpenCV_FOUND)
  12. message(FATAL_ERROR "Can not find OpenCV libs!")
  13. endif ()
  14. if (imgcodecs_FOUND)
  15. list(APPEND OpenCV_LIBS ${imgcodecs_libs})
  16. endif ()
  17. list(APPEND Samples_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS})
  18. list(APPEND Samples_LINK_LIBS ${OpenCV_LIBS})
  19. # ---[ thread
  20. list(APPEND Samples_LINK_LIBS pthread dl)
  21. set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin/)
  22. message(STATUS "@@@@@@@@@@@ Target : cnis_demo")
  23. aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} sample_srcs)
  24. add_executable(cnis_demo ${sample_srcs})
  25. add_sanitizers(cnis_demo)
  26. target_include_directories(cnis_demo PRIVATE
  27. ${Samples_INCLUDE_DIRS}
  28. ${CMAKE_CURRENT_SOURCE_DIR}/../include
  29. ${CMAKE_CURRENT_SOURCE_DIR})
  30. target_link_libraries(cnis_demo cnis ${Samples_LINK_LIBS})
  31. install(TARGETS cnis_demo RUNTIME DESTINATION bin)