Advertisement
Guest User

Untitled

a guest
May 17th, 2018
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 1.13 KB | None | 0 0
  1. set(CMAKE_PREMISES_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakePremises")
  2.  
  3. unset(GIT CACHE)
  4. find_program(GIT git)
  5. if(${GIT} STREQUAL "GIT-NOTFOUND")
  6.     message(FATAL_ERROR "Git not found. Add it to PATH and try again")
  7. endif()
  8.  
  9. macro(git)
  10.     execute_process(
  11.         COMMAND ${GIT} ${ARGN}
  12.         ERROR_VARIABLE ERROR_MESSAGE
  13.         RESULT_VARIABLE ERROR_CODE)
  14.        
  15.     if(NOT ${ERROR_CODE} EQUAL 0)
  16.         message(FATAL_ERROR "${ERROR_MESSAGE}")
  17.     endif()
  18. endmacro()
  19.  
  20. function(clone_CMakePremises)
  21.     git(
  22.         clone ssh://slb1-swt@vs-ssh.visualstudio.com:22/OLGA/_ssh/CMakePremises ${CMAKE_PREMISES_PATH}
  23.         WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
  24. endfunction()
  25.  
  26. function(update_CMakePremises)
  27.     git(
  28.         fetch --all
  29.         WORKING_DIRECTORY ${CMAKE_PREMISES_PATH})
  30.     git(
  31.         reset --hard HEAD
  32.         WORKING_DIRECTORY ${CMAKE_PREMISES_PATH})
  33. endfunction()
  34.  
  35. if(EXISTS ${CMAKE_PREMISES_PATH})
  36.     update_CMakePremises()
  37. else()
  38.     clone_CMakePremises()
  39. endif()
  40.  
  41. file(WRITE "${CMAKE_PREMISES_PATH}/.gitignore" "*")
  42.  
  43. include(${CMAKE_CURRENT_LIST_DIR}/CMakePremises/Dependencies.cmake)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement