Fix list_licenses macro
authorTimo Röhling <roehling@debian.org>
Sat, 23 Oct 2021 17:20:10 +0000 (19:20 +0200)
committerTimo Röhling <roehling@debian.org>
Wed, 2 Nov 2022 23:09:28 +0000 (23:09 +0000)
Gbp-Pq: Name 0005-Fix-list_licenses-macro.patch

CMakeLists.txt

index 6786b228dd8ccff620fc335c66d81785f34f47aa..8d674dcee0c576d963f6a7c186369273b016f2dc 100644 (file)
@@ -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)