ctkFunctionApplyPatches.cmake 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ###########################################################################
  2. #
  3. # Library: CTK
  4. #
  5. # Copyright (c) 2010 Kitware Inc.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.commontk.org/LICENSE
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. ###########################################################################
  20. #
  21. #
  22. #
  23. FUNCTION(ctkFunctionApplyPatches PATCH_EXE SRC_DIR PATCH_FILES)
  24. # Make sure patch executable exists
  25. IF(NOT EXISTS ${PATCH_EXE})
  26. MESSAGE(FATAL_ERROR "ERROR: Program [${PATCH_EXE}] doesn't exist !")
  27. ENDIF()
  28. # Apply patches
  29. FOREACH(patch_file ${PATCH_FILES})
  30. MESSAGE("Applying patch: ${patch_file}")
  31. EXECUTE_PROCESS(COMMAND ${PATCH_EXE} -p0 -i "${patch_file}" -d "${SRC_DIR}" RESULT_VARIABLE result_var)
  32. IF(result_var)
  33. MESSAGE("ERROR: ${result_var}")
  34. ENDIF(result_var)
  35. ENDFOREACH()
  36. ENDFUNCTION()