Advertisement
Guest User

Untitled

a guest
May 4th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 0.89 KB | None | 0 0
  1. # Adds a submodule subdirectory to be included in cmake. Will automatically
  2. # init it if its empty, and can optionally checkout any tag/branch if specified.
  3. macro(ksutil_add_submodule_directory PATH)
  4.     set(oneValueArgs TAG RENAME)
  5.  
  6.     cmake_parse_arguments(OPTS "${options}" "${oneValueArgs}" "" ${ARGN})
  7.  
  8.     # See if the dir is empty or not
  9.     file(GLOB RESULT ${PATH}/*)
  10.     list(LENGTH RESULT RES_LEN)
  11.     if(RES_LEN EQUAL 0)
  12.         # Empty so update it
  13.         execute_process(COMMAND git submodule update --init ${PATH} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} RESULT_VARIABLE CLONE_RESULT)
  14.         message("Clone result: ${CLONE_RESULT}")
  15.     endif()
  16.  
  17.     # And check out the right tag
  18.     if (OPTS_TAG)
  19.         execute_process(COMMAND git checkout ${OPTS_TAG} RESULT_VARIABLE CHECKOUT_RESULT)
  20.         message("Checkout result: ${CHECKOUT_RESULT}")
  21.     endif()
  22.  
  23. endmacro()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement