The package unixodbc is compatible with built-in CMake targets: FIND_PACKAGE(unixodbc REQUIRED) TARGET_LINK_LIBRARIES(main PRIVATE UNIX::odbc) for linkage