fontconfig is compatible with built-in CMake targets: find_package(Fontconfig REQUIRED) # since CMake 3.14 target_link_libraries(main PRIVATE Fontconfig::Fontconfig)