-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added GitSubmoduleCheck.cmake module
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
find_package(Git REQUIRED) | ||
|
||
# https://gist.github.com/scivision/bb1d47a9529e153617414e91ff5390af | ||
|
||
function(git_submodule_check dir) | ||
if(NOT EXISTS "${dir}/CMakeLists.txt") | ||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir} | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||
COMMAND_ERROR_IS_FATAL ANY) | ||
endif() | ||
# Add a Git submodule directory to CMake, assuming the Git submodule directory is a CMake project. | ||
# add_subdirectory(${dir} EXCLUDE_FROM_ALL) | ||
endfunction() |