diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..ff2d7a7dd --- /dev/null +++ b/.clang-format @@ -0,0 +1,4 @@ +--- +AccessModifierOffset: -3 +IndentWidth: 3 +... diff --git a/CMakeLists.txt b/CMakeLists.txt index 52ddb2e49..d260fba01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,12 @@ if(CMAKE_CXX_STANDARD LESS 17) set(CMAKE_CXX_STANDARD 17) endif() +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + include(GitSubmoduleCheck) + git_submodule_check(lib/external/asio) + git_submodule_check(lib/infra) +endif() + include(ElementsConfigCommon) option(ELEMENTS_BUILD_EXAMPLES "build Elements library examples" ON) diff --git a/cmake/GitSubmoduleCheck.cmake b/cmake/GitSubmoduleCheck.cmake new file mode 100644 index 000000000..9e36e992e --- /dev/null +++ b/cmake/GitSubmoduleCheck.cmake @@ -0,0 +1,9 @@ +# https://gist.github.com/scivision/bb1d47a9529e153617414e91ff5390af +find_package(Git REQUIRED) +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() +endfunction()