From: =?utf-8?q?Timo_R=C3=B6hling?= Date: Sat, 23 Oct 2021 19:20:10 +0200 Subject: Fix list_licenses macro --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55c48e4..f8d164e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -475,11 +475,13 @@ function(list_licenses OUTPUT MODULES) foreach(module ${_MODULES}) set(license_path "../../third_party/${module}/LICENSE") get_filename_component(fullname "${license_path}" ABSOLUTE) - string(APPEND CONTENT "${STR_OPENER}License and copyrights for ${module}:\n${STR_CLOSER},\n") - file(READ ${license_path} license_long) - string(REPLACE "\n" "${STR_CLOSER},\n${STR_OPENER}" license ${license_long}) - string(APPEND CONTENT ${STR_OPENER}${license}\n${STR_CLOSER},) - string(APPEND CONTENT "\n\n") + if(EXISTS ${license_path}) + string(APPEND CONTENT "${STR_OPENER}License and copyrights for ${module}:\n${STR_CLOSER},\n") + file(READ ${license_path} license_long) + string(REPLACE "\n" "${STR_CLOSER},\n${STR_OPENER}" license ${license_long}) + string(APPEND CONTENT ${STR_OPENER}${license}\n${STR_CLOSER},) + string(APPEND CONTENT "\n\n") + endif() endforeach() configure_file(${FILAMENT}/build/licenses.inc.in ${OUTPUT}) endfunction(list_licenses)