6c299000a7
This will generate the NOTICES.txt license file and SPDX-Licenses.json manifest file on every installer run. Signed-off-by: Mike Chang <changml@amazon.com>
39 lines
1.2 KiB
CMake
39 lines
1.2 KiB
CMake
#
|
|
# Copyright (c) Contributors to the Open 3D Engine Project.
|
|
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
#
|
|
#
|
|
|
|
set(LY_ROOT_FOLDER "@LY_ROOT_FOLDER@")
|
|
set(CMAKE_SCRIPT_MODE_FILE TRUE)
|
|
|
|
# Scan the engine and 3rd Party folders for licenses
|
|
cmake_path(SET _license_script_path "@LY_ROOT_FOLDER@/scripts/license_scanner")
|
|
cmake_path(SET _license_script "${_license_script_path}/license_scanner.py")
|
|
cmake_path(SET _license_config "${_license_script_path}/scanner_config.json")
|
|
|
|
set(_license_scan_path "@LY_ROOT_FOLDER@" "@LY_PACKAGE_UNPACK_LOCATION@")
|
|
set(_license_command
|
|
@LY_PYTHON_CMD@ -s
|
|
-u ${_license_script}
|
|
--config-file ${_license_config}
|
|
--license-file-path @CPACK_3P_LICENSE_FILE@
|
|
--package-file-path @CPACK_3P_MANIFEST_FILE@
|
|
)
|
|
|
|
message("Scanning ${_license_scan_path} for package licenses")
|
|
|
|
execute_process(
|
|
COMMAND ${_license_command} --scan-path ${_license_scan_path}
|
|
RESULT_VARIABLE _license_result
|
|
ERROR_VARIABLE _license_errors
|
|
OUTPUT_VARIABLE _license_output
|
|
ECHO_OUTPUT_VARIABLE
|
|
)
|
|
|
|
if(NOT ${_license_result} EQUAL 0)
|
|
message(FATAL_ERROR "An error occurred during license scan. ${_license_errors}")
|
|
endif()
|