cmake_minimum_required(VERSION 3.23) project(CommonCamera) set(CMAKE_CXX_STANDARD 14) set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/CommonCamera/lib) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/CommonCamera/include) # 海康威视 file(GLOB HK_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/CommonCamera/lib/hikvision/*.so ${CMAKE_CURRENT_SOURCE_DIR}/CommonCamera/lib/hikvision/*.so.*) # 大华 file(GLOB DH_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/CommonCamera/lib/dahua/*.so) add_library(HikVisionImpl SHARED ${CMAKE_CURRENT_SOURCE_DIR}/CommonCamera/src/HikVisionImpl.cpp) target_link_libraries(HikVisionImpl PUBLIC ${HK_LIBS}) add_library(DaHuaImpl SHARED ${CMAKE_CURRENT_SOURCE_DIR}/CommonCamera/src/DaHuaImpl.cpp) target_link_libraries(DaHuaImpl PUBLIC ${DH_LIBS}) add_executable(CommonCamera tests/main.cpp) target_link_libraries(CommonCamera PUBLIC HikVisionImpl DaHuaImpl) install(TARGETS HikVisionImpl DaHuaImpl LIBRARY DESTINATION /usr/local/lib) install(FILES ${HK_LIBS} DESTINATION /usr/local/lib) install(FILES ${DH_LIBS} DESTINATION /usr/local/lib) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/CommonCamera/include/ DESTINATION /usr/include/CommonCamera)