Skip to content

Using license file of package

Ruslan Baratov edited this page Oct 6, 2015 · 1 revision

After package was installed Hunter will search for the license file in sources. Next priority is used (see script):

  • LICENSE
  • LICENSE.txt
  • COPYING
  • COPYING.txt
  • license
  • license.txt
  • copying
  • copying.txt

If nothing is found the last try is the files found by command file(GLOB ... "${package_source_dir}/LICENSE*").

In case search was successful variable <PACKAGE>_LICENSE can be used to obtain full path to the license (example):

hunter_add_package(Boost)
file(READ "${Boost_LICENSE}" boost_license_content)

set(project_license "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
file(
    WRITE
    "${project_license}"
    "Some info about this project license.\n\n"
    "== 3rd party licenses ==\n\n"
    "== Boost ==\n\n"
    "${boost_license_content}"
)

Clone this wiki locally