| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- # Smartbotic Database Client Library
- if(BUILD_SHARED_LIBS)
- add_library(smartbotic-db-client SHARED
- src/client.cpp
- $<TARGET_OBJECTS:smartbotic_db_proto>
- )
- set_target_properties(smartbotic-db-client PROPERTIES
- VERSION ${SMARTBOTIC_DB_VERSION}
- SOVERSION 2
- )
- else()
- add_library(smartbotic-db-client STATIC
- src/client.cpp
- )
- endif()
- target_include_directories(smartbotic-db-client PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
- $<INSTALL_INTERFACE:include>
- )
- # Link dependencies
- target_link_libraries(smartbotic-db-client PUBLIC
- smartbotic_db_proto
- )
- if(TARGET nlohmann_json::nlohmann_json)
- target_link_libraries(smartbotic-db-client PUBLIC nlohmann_json::nlohmann_json)
- else()
- target_include_directories(smartbotic-db-client PUBLIC ${NLOHMANN_JSON_INCLUDE_DIRS})
- endif()
- if(TARGET spdlog::spdlog)
- target_link_libraries(smartbotic-db-client PUBLIC spdlog::spdlog)
- else()
- target_link_libraries(smartbotic-db-client PUBLIC ${SPDLOG_LIBRARIES})
- target_include_directories(smartbotic-db-client PUBLIC ${SPDLOG_INCLUDE_DIRS})
- endif()
- # Export alias
- add_library(smartbotic::db-client ALIAS smartbotic-db-client)
- # Installation (standalone/packaging only)
- if(SMARTBOTIC_DB_STANDALONE)
- include(GNUInstallDirs)
- install(TARGETS smartbotic-db-client
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- )
- install(DIRECTORY include/smartbotic
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
- )
- endif()
|