mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-11-25 13:11:36 +00:00
build(cmake): build bundled GoogleTest with FetchContent
- Add the bundled GoogleTest with FetchContent and OVERRIDE_FIND_PACKAGE, so it uses the compiler and flags of the FairMQ build - Build it in a block() without gmock, install and static analysis - Replace build_bundled() with fairmq_init_submodule(), which runs git submodule update only if the submodule folder is empty, and stops with a clear error if it stays empty - Install the bundled FairCMakeModules into the build directory with its tests off, as before - Use the bundled PicoSHA2 headers directly from the source tree - With USE_EXTERNAL_GTEST, GTest is a private dependency and no longer in FairMQ_PACKAGE_DEPENDENCIES Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,7 @@ The error also occurs when the value `ON` is in the cache from an earlier config
|
||||
| Boost | 1.66 or later, but not 1.88 | `BUILD_FAIRMQ` or `BUILD_TIDY_TOOL` | public |
|
||||
| ZeroMQ | 4.1.4 or later | `BUILD_FAIRMQ` | private |
|
||||
| PicoSHA2 | bundled | `BUILD_FAIRMQ` | bundled |
|
||||
| GoogleTest | bundled | `BUILD_TESTING` | bundled, or public with `USE_EXTERNAL_GTEST` |
|
||||
| GoogleTest | bundled | `BUILD_TESTING` | bundled, or private with `USE_EXTERNAL_GTEST` |
|
||||
| LLVM, Clang, CLI11 | any | `BUILD_TIDY_TOOL` | private |
|
||||
| FairCMakeModules | 0.2 or later | always | private, bundled if CMake does not find it |
|
||||
|
||||
@@ -69,7 +69,10 @@ The kinds have these effects:
|
||||
|
||||
- **Public**: the installed package records the dependency. A project that uses FairMQ must find the package too. See [The installed package](#the-installed-package).
|
||||
- **Private**: only the FairMQ build uses the package.
|
||||
- **Bundled**: the code is in a Git submodule in `extern/`. The configure step runs `git submodule update --init` for it. Then it builds GoogleTest and FairCMakeModules in the build directory under `extern/`. The log of this build is `build.log` in the same directory. PicoSHA2 is a header-only library.
|
||||
- **Bundled**: the code is in a Git submodule in `extern/`. If the folder of the submodule is empty, the configure step runs `git submodule update --init` for it. If the folder stays empty, the configure step stops with an error.
|
||||
- FairCMakeModules: the configure step installs the bundled copy into `extern/FairCMakeModules_install` in the build directory. The log is `extern/FairCMakeModules/build.log` in the build directory.
|
||||
- GoogleTest: the build compiles the bundled copy as part of the FairMQ build, with `FetchContent`. Thus it uses the same compiler and flags. It is not installed.
|
||||
- PicoSHA2: a header-only library.
|
||||
|
||||
Boost 1.88 replaced the Boost.Process API with version 2. With Boost 1.88, the configure step stops with an error. With Boost 1.89 or later, FairMQ uses the header `boost/process/v1.hpp`.
|
||||
|
||||
@@ -239,7 +242,7 @@ The package does not search its dependencies. Your project must find Boost, Fair
|
||||
| `FairMQ_BUILD_TYPE` | The `CMAKE_BUILD_TYPE` of the FairMQ build. |
|
||||
| `FairMQ_BUILD_TYPE_UPPER` | The same value in upper case. |
|
||||
| `FairMQ_CXX_FLAGS` | `CMAKE_CXX_FLAGS` and `CMAKE_CXX_FLAGS_<BUILD_TYPE>` of the FairMQ build, as a list. |
|
||||
| `FairMQ_PACKAGE_DEPENDENCIES` | The public dependencies: `Threads`, `FairLogger`, `Boost`, and the public dependencies that these packages declare. With `BUILD_TESTING` and `USE_EXTERNAL_GTEST`, also `GTest`. |
|
||||
| `FairMQ_PACKAGE_DEPENDENCIES` | The public dependencies: `Threads`, `FairLogger`, `Boost`, and the public dependencies that these packages declare. |
|
||||
| `FairMQ_<dep>_VERSION` | The minimum version of `<dep>` that the build required, for example `FairMQ_FairLogger_VERSION` is `1.6.0`. |
|
||||
| `FairMQ_<dep>_COMPONENTS` | The components of `<dep>` that the build required, for example the five components in `FairMQ_Boost_COMPONENTS`. |
|
||||
| `FairMQ_<component>_FOUND` | `TRUE` for each [component](#components) of the installation. |
|
||||
|
||||
@@ -232,7 +232,7 @@ The CMake code of FairMQ uses `PROJECT_SOURCE_DIR` and `PROJECT_BINARY_DIR` for
|
||||
Some things still depend on the Git repository of FairMQ:
|
||||
|
||||
- `cmake/GitHelper.cmake` reads the version with `git describe` in the directory of the FairMQ `CMakeLists.txt`, and only if it has a `.git` entry. Without it, the version is `0.0.0.0`.
|
||||
- The bundled copies of GoogleTest, PicoSHA2 and FairCMakeModules are Git submodules. A source archive from GitHub has no `.git` folder and the folders in `extern/` are empty. If FairCMakeModules is not installed, the configure step stops when it tries to build the bundled copy: `git submodule update` fails with `fatal: not a git repository`. The log is `extern/FairCMakeModules/build.log` in the build directory. Use a Git clone with the tags (see [Install](/start/install/#problems-that-can-occur)) and its submodules.
|
||||
- The bundled copies of GoogleTest, PicoSHA2 and FairCMakeModules are Git submodules. A source archive from GitHub has no `.git` folder and the folders in `extern/` are empty. If FairCMakeModules is not installed, the configure step stops with the error `The bundled package in extern/FairCMakeModules is missing`. Use a Git clone with the tags (see [Install](/start/install/#problems-that-can-occur)) and its submodules.
|
||||
|
||||
`FetchContent_MakeAvailable(FairMQ)` adds the downloaded source with `add_subdirectory()`. For a Git clone, use `GIT_SUBMODULES`. The FairMQ project did not test `FetchContent`.
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ The CI of FairMQ builds and tests FairMQ on Linux (Ubuntu 24.04) with GCC 12, 13
|
||||
| git | — | CMake reads the version of FairMQ from git and gets the bundled copies with git. |
|
||||
| LLVM, Clang, [CLI11](https://github.com/CLIUtils/CLI11) | — | Only for the tool `fairmq-tidy`. |
|
||||
|
||||
The bundled copies are git submodules in the folder `extern/` of the repository. When CMake needs a bundled copy, it runs `git submodule update --init` for it.
|
||||
The bundled copies are git submodules in the folder `extern/` of the repository. When CMake needs a bundled copy and its folder is empty, CMake runs `git submodule update --init` for it.
|
||||
|
||||
## Install FairMQ
|
||||
|
||||
|
||||
Reference in New Issue
Block a user