 -      -DZSTD_BUILD_PROGRAMS=OFF
 -      ${extra_cmake_args}
 -    # Note: zstd v1.4.6 will include the following fix. When that is released, upgrade and remove this patch.
--    PATCH_COMMAND patch -p1 -d . < ${CMAKE_CURRENT_SOURCE_DIR}/cmake_minimum_required_2.8.12.patch)
+-    PATCH_COMMAND
+-      patch -p1 -d . < ${CMAKE_CURRENT_SOURCE_DIR}/cmake_minimum_required_2.8.12.patch &&
+-      patch -p1 -d . < ${CMAKE_CURRENT_SOURCE_DIR}/no_internal_headers.patch
+-  )
 -
 -  install(
 -    DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_install/
--    DESTINATION ${CMAKE_INSTALL_PREFIX})
+-    DESTINATION ${CMAKE_INSTALL_PREFIX}
+-    USE_SOURCE_PERMISSIONS)
 -endmacro()
 -
 -if (NOT zstd_FOUND OR "${zstd_VERSION}" VERSION_LESS 1.4.4)

From 41d2f28fe1fca0274150bca42fcd7382f6068e0f Mon Sep 17 00:00:00 2001
From: Martin Jansa <martin.jansa@lge.com>
Date: Fri, 5 Jun 2020 11:35:25 -0700
Subject: [PATCH] CMakeLists.txt: prevent building zstd with ExternalProject


Signed-off-by: Martin Jansa <martin.jansa@lge.com>
---
 CMakeLists.txt | 49 ++++---------------------------------------------
 1 file changed, 4 insertions(+), 45 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 108f63c4..78efbc22 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,55 +9,14 @@ option(FORCE_BUILD_VENDOR_PKG
   OFF)
 
 if(NOT FORCE_BUILD_VENDOR_PKG)
