PageRenderTime 31ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/cmake/DeploySharedLibs.cmake

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 73 lines | 53 code | 11 blank | 9 comment | 7 complexity | 0c31a31a7e4e2cf4969275f6b45d6202 MD5 | raw file
Possible License(s): LGPL-2.1
  1. # DeploySharedLibs.cmake
  2. # This is a script to be run at build time! Its not part of the cmake configuration!
  3. # See indra/cmake/LLSharedLibs.cmake for a macro that simplifies adding a command to a target to run this script.
  4. # This script requires a few cmake variable to be set on the command line:
  5. # BIN_NAME= The full path the the binary to search for dependecies.
  6. # SEARCH_DIRS= The full paths to dirs to search for dependencies.
  7. # DST_PATH= The full path where the dependecies will be copied.
  8. # *FIX:Mani - I pulled in the CMake 2.8 GetPrerequisites.cmake script here, because it works on windows where 2.6 did not.
  9. # Once we have officially upgraded to 2.8 we can just use that version of GetPrerequisites.cmake.
  10. get_filename_component(current_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
  11. include(${current_dir}/GetPrerequisites_2_8.cmake)
  12. message("Getting recursive dependencies for file: ${BIN_NAME}")
  13. set(EXCLUDE_SYSTEM 1)
  14. set(RECURSE 1)
  15. get_filename_component(EXE_PATH ${BIN_NAME} PATH)
  16. get_prerequisites( ${BIN_NAME} RESULTS ${EXCLUDE_SYSTEM} ${RECURSE} "${EXE_PATH}" "${SEARCH_DIRS}" )
  17. foreach(DEP ${RESULTS})
  18. Message("Processing dependency: ${DEP}")
  19. get_filename_component(DEP_FILE ${DEP} NAME)
  20. set(DEP_FILES ${DEP_FILES} ${DEP_FILE})
  21. endforeach(DEP)
  22. if(DEP_FILES)
  23. list(REMOVE_DUPLICATES DEP_FILES)
  24. endif(DEP_FILES)
  25. foreach(DEP_FILE ${DEP_FILES})
  26. if(FOUND_FILES)
  27. list(FIND FOUND_FILES ${DEP_FILE} FOUND)
  28. else(FOUND_FILES)
  29. set(FOUND -1)
  30. endif(FOUND_FILES)
  31. if(FOUND EQUAL -1)
  32. find_path(DEP_PATH ${DEP_FILE} PATHS ${SEARCH_DIRS} NO_DEFAULT_PATH)
  33. if(DEP_PATH)
  34. set(FOUND_FILES ${FOUND_FILES} "${DEP_PATH}/${DEP_FILE}")
  35. set(DEP_PATH NOTFOUND) #reset DEP_PATH for the next find_path call.
  36. else(DEP_PATH)
  37. set(MISSING_FILES ${MISSING_FILES} ${DEP_FILE})
  38. endif(DEP_PATH)
  39. endif(FOUND EQUAL -1)
  40. endforeach(DEP_FILE)
  41. if(MISSING_FILES)
  42. message("Missing:")
  43. foreach(FILE ${MISSING_FILES})
  44. message(" ${FILE}")
  45. endforeach(FILE)
  46. message("Searched in:")
  47. foreach(SEARCH_DIR ${SEARCH_DIRS})
  48. message(" ${SEARCH_DIR}")
  49. endforeach(SEARCH_DIR)
  50. message(FATAL_ERROR "Failed")
  51. endif(MISSING_FILES)
  52. if(FOUND_FILES)
  53. foreach(FILE ${FOUND_FILES})
  54. get_filename_component(DST_FILE ${FILE} NAME)
  55. set(DST_FILE "${DST_PATH}/${DST_FILE}")
  56. message("Copying ${FILE} to ${DST_FILE}")
  57. execute_process(
  58. COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE} ${DST_FILE}
  59. )
  60. endforeach(FILE ${FOUND_FILES})
  61. endif(FOUND_FILES)
  62. message("Success!")