PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/cmake/Prebuilt.cmake

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 53 lines | 39 code | 5 blank | 9 comment | 9 complexity | c06933a02bd1ffdf05cdf601454df10a MD5 | raw file
Possible License(s): LGPL-2.1
  1. # -*- cmake -*-
  2. include(FindAutobuild)
  3. if(INSTALL_PROPRIETARY)
  4. include(FindSCP)
  5. endif(INSTALL_PROPRIETARY)
  6. # The use_prebuilt_binary macro handles automated installation of package
  7. # dependencies using autobuild. The goal is that 'autobuild install' should
  8. # only be run when we know we need to install a new package. This should be
  9. # the case in a clean checkout, or if autobuild.xml has been updated since the
  10. # last run (encapsulated by the file ${CMAKE_BINARY_DIR}/temp/sentinel_installed),
  11. # or if a previous attempt to install the package has failed (the exit status
  12. # of previous attempts is serialized in the file
  13. # ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
  14. macro (use_prebuilt_binary _binary)
  15. if (NOT DEFINED STANDALONE_${_binary})
  16. set(STANDALONE_${_binary} ${STANDALONE})
  17. endif (NOT DEFINED STANDALONE_${_binary})
  18. if (NOT STANDALONE_${_binary})
  19. if("${${_binary}_installed}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/${_binary}_installed")
  20. file(READ ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${_binary}_installed")
  21. if(DEBUG_PREBUILT)
  22. message(STATUS "${_binary}_installed: \"${${_binary}_installed}\"")
  23. endif(DEBUG_PREBUILT)
  24. endif("${${_binary}_installed}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/${_binary}_installed")
  25. if(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed OR NOT ${${_binary}_installed} EQUAL 0)
  26. if(DEBUG_PREBUILT)
  27. message("cd ${CMAKE_SOURCE_DIR} && ${AUTOBUILD_EXECUTABLE} install
  28. --install-dir=${AUTOBUILD_INSTALL_DIR}
  29. --skip-license-check
  30. ${_binary} ")
  31. endif(DEBUG_PREBUILT)
  32. execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}"
  33. install
  34. --install-dir=${AUTOBUILD_INSTALL_DIR}
  35. --skip-license-check
  36. ${_binary}
  37. WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
  38. RESULT_VARIABLE ${_binary}_installed
  39. )
  40. file(WRITE ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${${_binary}_installed}")
  41. endif(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed OR NOT ${${_binary}_installed} EQUAL 0)
  42. if(NOT ${_binary}_installed EQUAL 0)
  43. message(FATAL_ERROR
  44. "Failed to download or unpack prebuilt '${_binary}'."
  45. " Process returned ${${_binary}_installed}.")
  46. endif (NOT ${_binary}_installed EQUAL 0)
  47. endif (NOT STANDALONE_${_binary})
  48. endmacro (use_prebuilt_binary _binary)