aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorRechi <Rechi@users.noreply.github.com>2019-01-24 12:32:05 +0100
committerRechi <Rechi@users.noreply.github.com>2019-01-24 12:32:05 +0100
commitccefc5295812c21cb12024298e1c6d5cd444bd65 (patch)
treef446e86e94bc0e6fc98d3a00f11250edbb25f385 /cmake
parentbd99f17b03ae249ed58889bd042b370517370b56 (diff)
[cmake] replace patch file with actual commands in add_addon_depends
Diffstat (limited to 'cmake')
-rw-r--r--cmake/scripts/common/HandleDepends.cmake24
1 files changed, 6 insertions, 18 deletions
diff --git a/cmake/scripts/common/HandleDepends.cmake b/cmake/scripts/common/HandleDepends.cmake
index 47f7d9b768..40e382b94c 100644
--- a/cmake/scripts/common/HandleDepends.cmake
+++ b/cmake/scripts/common/HandleDepends.cmake
@@ -88,16 +88,12 @@ function(add_addon_depends addon searchpath)
message(${BUILD_ARGS})
endif()
- # prepare patchfile. ensure we have a clean file after reconfiguring
- set(PATCH_FILE ${BUILD_DIR}/${id}/tmp/patch.cmake)
- file(REMOVE ${PATCH_FILE})
+ set(PATCH_COMMAND)
# if there's a CMakeLists.txt use it to prepare the build
if(EXISTS ${dir}/CMakeLists.txt)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/CMakeLists.txt)
- file(APPEND ${PATCH_FILE}
- "file(COPY ${dir}/CMakeLists.txt
- DESTINATION ${BUILD_DIR}/${id}/src/${id})\n")
+ list(APPEND PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy_if_different ${dir}/CMakeLists.txt ${BUILD_DIR}/${id}/src/${id})
endif()
# check if we have patches to apply
@@ -124,14 +120,13 @@ function(add_addon_depends addon searchpath)
file(READ ${patch} patch_content_hex HEX)
# Force handle LF-only line endings
if(NOT patch_content_hex MATCHES "0d0a")
- set(PATCH_PROGRAM "\"${PATCH_PROGRAM}\" --binary")
+ list(APPEND PATCH_PROGRAM --binary)
endif()
endif()
endif()
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${patch})
- file(APPEND ${PATCH_FILE}
- "execute_process(COMMAND ${PATCH_PROGRAM} -p1 -i \"${patch}\")\n")
+ list(APPEND PATCH_COMMAND COMMAND ${PATCH_PROGRAM} -p1 -i ${patch})
endforeach()
@@ -168,18 +163,11 @@ function(add_addon_depends addon searchpath)
if(CROSS_AUTOCONF AND AUTOCONF_FILES)
foreach(afile ${AUTOCONF_FILES})
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${afile})
- file(APPEND ${PATCH_FILE}
- "message(STATUS \"AUTOCONF: copying ${afile} to ${BUILD_DIR}/${id}/src/${id}\")\n
- file(COPY ${afile} DESTINATION ${BUILD_DIR}/${id}/src/${id})\n")
+ list(APPEND PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E echo "AUTOCONF: copying ${afile} to ${BUILD_DIR}/${id}/src/${id}")
+ list(APPEND PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy_if_different ${afile} ${BUILD_DIR}/${id}/src/${id})
endforeach()
endif()
- # if the patch file exists we need to set the PATCH_COMMAND
- set(PATCH_COMMAND "")
- if(EXISTS ${PATCH_FILE})
- set(PATCH_COMMAND ${CMAKE_COMMAND} -P ${PATCH_FILE})
- endif()
-
# prepare the setup of the call to externalproject_add()
set(EXTERNALPROJECT_SETUP PREFIX ${BUILD_DIR}/${id}
CMAKE_ARGS ${extraflags} ${BUILD_ARGS}