The package quantlib provides CMake targets:

    find_package(QuantLib CONFIG REQUIRED)
    target_link_libraries(main PRIVATE QuantLib::QuantLib)