Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Adds a submodule subdirectory to be included in cmake. Will automatically
- # init it if its empty, and can optionally checkout any tag/branch if specified.
- macro(ksutil_add_submodule_directory PATH)
- set(oneValueArgs TAG RENAME)
- cmake_parse_arguments(OPTS "${options}" "${oneValueArgs}" "" ${ARGN})
- # See if the dir is empty or not
- file(GLOB RESULT ${PATH}/*)
- list(LENGTH RESULT RES_LEN)
- if(RES_LEN EQUAL 0)
- # Empty so update it
- execute_process(COMMAND git submodule update --init ${PATH} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} RESULT_VARIABLE CLONE_RESULT)
- message("Clone result: ${CLONE_RESULT}")
- endif()
- # And check out the right tag
- if (OPTS_TAG)
- execute_process(COMMAND git checkout ${OPTS_TAG} RESULT_VARIABLE CHECKOUT_RESULT)
- message("Checkout result: ${CHECKOUT_RESULT}")
- endif()
- endmacro()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement