soci provides CMake targets: find_package(soci CONFIG REQUIRED) target_link_libraries(main PRIVATE $,SOCI::soci_core,SOCI::soci_core_static>) # Linking specific backends (enabled: @backends@) target_link_libraries(main PRIVATE $,SOCI::soci_,SOCI::soci__static>)