The SPDX project of the linux foundation has some nice way to declare machine readable license information in source code.
Basically one adds a string like this to each source file, declaring the license in use:
/
SPDX-License-Identifier: LGPL-3.0-or-later
/
This helps automated tools to discover license information about the source code.