CMakeLists.txt 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. set(LIBRARY_NAME libpcl)
  2. unset(OPTION_ENABLE_TEST_CODE CACHE)
  3. option(OPTION_ENABLE_TEST_CODE "Whether enable test code." OFF)
  4. message("<=${LIBRARY_NAME}=> OPTION_ENABLE_TEST_CODE: " ${OPTION_ENABLE_TEST_CODE})
  5. if (NOT ENABLE_LIBRARY_GOOGLE_LOG)
  6. message(FATAL_ERROR "Not enable ENABLE_LIBRARY_GOOGLE_LOG")
  7. endif ()
  8. include_directories(${PCL_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
  9. set(LIBRARY_SOURCE_LIST
  10. ${CMAKE_CURRENT_LIST_DIR}/point2D_tool.h
  11. ${CMAKE_CURRENT_LIST_DIR}/point2D_tool.cpp
  12. ${CMAKE_CURRENT_LIST_DIR}/point3D_tool.h
  13. ${CMAKE_CURRENT_LIST_DIR}/point3D_tool.cpp
  14. )
  15. set(LIBRARY_DEPEND_LIST liblog ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
  16. add_library(${LIBRARY_NAME} ${LIBRARY_SOURCE_LIST})
  17. target_link_libraries(${LIBRARY_NAME} PUBLIC ${LIBRARY_DEPEND_LIST})
  18. if (OPTION_ENABLE_TEST_CODE)
  19. set(LIBRARY_TEST_NAME "${LIBRARY_NAME}_test")
  20. set(LIBRARY_TEST_SOURCE_LIST
  21. ${CMAKE_CURRENT_LIST_DIR}/test.h
  22. ${CMAKE_CURRENT_LIST_DIR}/test.cpp
  23. )
  24. add_executable(${LIBRARY_TEST_NAME} ${LIBRARY_TEST_SOURCE_LIST})
  25. target_link_libraries(${LIBRARY_TEST_NAME} ${LIBRARY_NAME} )
  26. endif ()