libxmp provides CMake targets: find_package(libxmp CONFIG REQUIRED) target_link_libraries(main PRIVATE $,libxmp::xmp_shared,libxmp::xmp_static>)