From 79ea387c40ad271e29342b9a1dbf2d29cf8cbd01 Mon Sep 17 00:00:00 2001 From: Darius Neatu Date: Thu, 12 Dec 2024 00:37:39 +0200 Subject: [PATCH] Update BEMAN_STANDARD.md: add REPOSITORY.DISALLOW_GIT_SUBMODULES and CMAKE.USE_FETCH_CONTENT --- docs/BEMAN_STANDARD.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/BEMAN_STANDARD.md b/docs/BEMAN_STANDARD.md index 420ca6c..b004801 100644 --- a/docs/BEMAN_STANDARD.md +++ b/docs/BEMAN_STANDARD.md @@ -94,6 +94,12 @@ Examples: A `beman.smart_pointer` library's repository should be named `smart_po **[REPOSITORY.CODEOWNERS]** REQUIREMENT: There must be a `.github/CODEOWNERS` file with a relevant set of codeowners. +**[REPOSITORY.DISALLOW_GIT_SUBMODULES]** RECOMMENDATION: The repository should not use git submodules. Check `CMAKE.USE_FETCH_CONTENT` for alternatives. + +Known exceptions: +* [mpark/wg21: Framework for Writing C++ Committee Papers](https://github.com/mpark/wg21): A non-C++ submodule designed for drafting ISO C++ papers using LaTeX or Markdown. + + ## Top-level The top-level of a Beman library repository must consist of `CMakeLists.txt`, @@ -137,6 +143,23 @@ contain a one- or two-paragraph summary describing the library's purpose. **[CMAKE.DEFAULT]** RECOMMENDATION: The root `CMakeLists.txt` should build all targets by default (including dependency targets). +**[CMAKE.USE_FETCH_CONTENT]** RECOMMENDATION: The root `CMakeLists.txt` should fetch all dependency targets via [CMake FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html). + +Use the following style: + +```CMake +FetchContent_Declare( + + EXCLUDE_FROM_ALL + GIT_REPOSITORY ${GIT_REPOSITORY} + GIT_TAG ${GIT_TAG} +) +FetchContent_MakeAvailable() +``` + +Check `[CMAKE.SKIP_TESTS]` in this document for a working example or [exemplar/blob/main/CMakeLists.txt](https://github.com/bemanproject/exemplar/blob/main/CMakeLists.txt). + + **[CMAKE.PROJECT_NAME]** RECOMMENDATION: The CMake project name should be identical to the beman library name. @@ -204,7 +227,7 @@ if(BEMAN__BUILD_TESTS) endif() ``` -**[CMAKE.SKIP_EXAMPLES]** RECOMMENDATION: The root `CMakeLists.txt` should not build examples and their dependencies when `BEMAN__BUILD_EXAMPLES` is set to `OFF`. The option is prefixed with the project so that projects can compose. Turning on examples for the top level project should not turn on examples for dependencies. +**[CMAKE.SKIP_EXAMPLES]** RECOMMENDATION: The root `CMakeLists.txt` should not build examples and their dependencies when `BEMAN__BUILD_EXAMPLES` is set to `OFF`. The option is prefixed with the project so that projects can compose. Turning on examples for the top level project should not turn on examples for dependencies. Use the following style: