Added GitSubmoduleCheck.cmake module
This commit is contained in:
parent
c6287a121d
commit
d91b338e1b
2 changed files with 25 additions and 0 deletions
|
|
@ -15,6 +15,18 @@ set(PROJECT_REPOSITORY https://github.com/sfztools/sfizz)
|
||||||
|
|
||||||
# External configuration CMake scripts
|
# External configuration CMake scripts
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
# Ensure presence of Git submodules (when not using the source tarball)
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||||
|
include(GitSubmoduleCheck)
|
||||||
|
git_submodule_check(external/abseil-cpp)
|
||||||
|
git_submodule_check(external/filesystem)
|
||||||
|
git_submodule_check(external/simde)
|
||||||
|
git_submodule_check(external/st_audiofile/thirdparty/dr_libs)
|
||||||
|
git_submodule_check(external/st_audiofile/thirdparty/libaiff)
|
||||||
|
git_submodule_check(external/st_audiofile/thirdparty/wavpack)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(BuildType)
|
include(BuildType)
|
||||||
|
|
||||||
# Build Options
|
# Build Options
|
||||||
|
|
|
||||||
13
cmake/GitSubmoduleCheck.cmake
Normal file
13
cmake/GitSubmoduleCheck.cmake
Normal file
|
|
@ -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()
|
||||||
Loading…
Add table
Reference in a new issue