QtMobilityGitBranch1.0-patch.cmake.in 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # the patch step is run before the update step
  2. # so we need to checkout the 1.0 branch here
  3. set(work_dir @ep_source_dir@)
  4. set(proj_dir ${work_dir}/@proj@)
  5. execute_process(
  6. COMMAND @Git_EXECUTABLE@ checkout -b branch_1.0 origin/1.0 -t
  7. WORKING_DIRECTORY ${proj_dir}
  8. ERROR_VARIABLE error_output
  9. RESULT_VARIABLE error_code
  10. )
  11. if(error_code)
  12. if(NOT ${error_output} MATCHES "branch branch_1.0 already exists")
  13. message(FATAL_ERROR "${error_output}")
  14. endif()
  15. endif()
  16. INCLUDE(@CTK_SOURCE_DIR@/CMake/ctkMacroApplyPatches.cmake)
  17. SET(patch_dir @qtmobility_patch_dir@)
  18. SET(configured_patch_dir @qtmobility_configured_patch_dir@)
  19. # Variable required to properly configured the patch files
  20. SET(QT_BINARY_DIR @QT_BINARY_DIR@)
  21. SET(patch_files
  22. )
  23. IF(WIN32)
  24. CONFIGURE_FILE(${patch_dir}/QtMobilityGitBranch1.0-win32.patch.in
  25. ${configured_patch_dir}/QtMobilityGitBranch1.0-win32.patch @ONLY)
  26. LIST(APPEND patch_files
  27. ${configured_patch_dir}/QtMobilityGitBranch1.0-win32.patch
  28. )
  29. ENDIF()
  30. IF(UNIX)
  31. IF(APPLE)
  32. LIST(APPEND patch_files ${patch_dir}/QtMobilityGitBranch1.0-apple.patch)
  33. ENDIF()
  34. ENDIF()
  35. # Apply patches
  36. ctkMacroApplyPatches("@CTK_PATCH_EXECUTABLE@" "@qtmobility_src_dir@" "${patch_files}")
  37. IF(UNIX)
  38. # replace all occurences of 'qmake' with the aboslute path to the
  39. # qmake executable found by CMake.
  40. # This is neccessary for custom Qt builds and for Unix/Linux systems
  41. # which use another name for the Qt4 qmake program (e.g. qmake-qt4)
  42. EXECUTE_PROCESS(
  43. COMMAND sed -i "s+qmake +@QT_QMAKE_EXECUTABLE@ +g" configure
  44. WORKING_DIRECTORY ${proj_dir}
  45. RESULT_VARIABLE error_code
  46. )
  47. IF(error_code)
  48. MESSAGE(FATAL_ERROR "Patching ${proj_dir}/configure file failed.")
  49. ENDIF()
  50. ENDIF()
  51. # Let's add the updated files to the local repository. That way, 'git pull'
  52. # will try to merge the branch changes with the local ones
  53. execute_process(
  54. COMMAND @Git_EXECUTABLE@ add --all
  55. WORKING_DIRECTORY ${proj_dir}
  56. ERROR_VARIABLE error_output
  57. RESULT_VARIABLE error_code
  58. )