libopnmidi provides CMake targets: find_package(libOPNMIDI CONFIG REQUIRED) target_link_libraries(main PRIVATE libOPNMIDI::OPNMIDI_IF)