From a97a0b749857d0919b5c5ac500be280a0e113844 Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Wed, 20 Apr 2016 15:35:44 +0200
Subject: [PATCH] DOC: install copyrights and license in output SuperBuild
 package

---
 SuperBuild/CMake/External_otb.cmake  |  5 +++++
 SuperBuild/CMake/PackageHelper.cmake | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/SuperBuild/CMake/External_otb.cmake b/SuperBuild/CMake/External_otb.cmake
index 2a751073d7..1ceaf1298d 100644
--- a/SuperBuild/CMake/External_otb.cmake
+++ b/SuperBuild/CMake/External_otb.cmake
@@ -191,6 +191,11 @@ ExternalProject_Add(OTB
     CMAKE_COMMAND ${OTB_SB_CMAKE_COMMAND}
     )
 
+ExternalProject_Add_Step(OTB install_copyright
+  COMMAND ${CMAKE_COMMAND} -E copy_directory ${OTB_SB_SRC}/Copyright ${CMAKE_INSTALL_PREFIX}/share/copyright
+  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Copyright ${CMAKE_INSTALL_PREFIX}/share/copyright
+  DEPENDEES install)
+
   # detect OTB version number
   if (SUPERBUILD_OTB_VERSION)
     set(_SB_OTB_DIR ${SB_INSTALL_PREFIX}/lib/cmake/OTB-${SUPERBUILD_OTB_VERSION_MAJOR}.${SUPERBUILD_OTB_VERSION_MINOR})
diff --git a/SuperBuild/CMake/PackageHelper.cmake b/SuperBuild/CMake/PackageHelper.cmake
index 0dd512811f..b9c29e6c86 100644
--- a/SuperBuild/CMake/PackageHelper.cmake
+++ b/SuperBuild/CMake/PackageHelper.cmake
@@ -207,6 +207,25 @@ function(install_common include_mvd)
   ####################### Install otb applications ######################
   install(DIRECTORY "${OTB_APPLICATIONS_DIR}"  DESTINATION ${PKG_OTBLIBS_DIR})
 
+  ####################### Install copyrights ######################
+  install(DIRECTORY ${PKG_SHARE_SOURCE_DIR}/copyright DESTINATION ${PKG_SHARE_DEST_DIR})
+  file(WRITE "${PKG_STAGE_DIR}/Copyright.txt"
+"The OTB is released under the CeCILL-2.0 license. This license is available
+online :
+  http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
+  http://www.cecill.info/licences/Licence_CeCILL_V2-fr.html
+More details on copyright information can be found in :
+  share/copyright
+
+However this binary package may be compiled with dependencies that have
+incompatible licensing. As a consequence, this OTB binary package will be
+released under GPL-v2 license in the following cases :
+- if ITK (used by OTB) was built with FFTW support enabled (FFTW is released
+under GPL-v2 license)
+- if this package was built using FreeType. FreeType allows to choose between
+the advertising FreeType license and the GPL-v2 license.
+")
+
 endfunction()
 
 function(install_monteverdi_files)
-- 
GitLab