Skip to content

nlohmann_json Fix, master branch (2020.01.06.)

As reported by @sutt, some tweaks had to be made to make partial builds against the nightlies successful. In case one wants to build a package against the current nightlies that indirectly uses nlohmann_json, the CMake configuration breaks down like:

CMake Error at /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2020-01-04T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/cmake/modules/AtlasLibraryFunctions.cmake:142 (add_library):
  Target "TrigInDetAnalysisExampleLib" links to target
  "nlohmann_json::nlohmann_json" but the target was not found.  Perhaps a
  find_package() call is missing for an IMPORTED target, or an ALIAS target
  is missing?
Call Stack (most recent call first):
  /srv/athena/Trigger/TrigAnalysis/TrigInDetAnalysisExample/CMakeLists.txt:37 (atlas_add_library)

We have seen similar issues with Acts in the past, which was overcome using a "pre-configuration" feature that our CMake configuration has since practically the beginning. (Such pre-config scripts are processed before the "main" script of an installed project.)

This MR adds find_package(nlohmann_json) to the PreConfig.cmake script of Athena, and creates a PreConfig.cmake script for AthSimulation for the same purpose.

I modified the logic in Athena/cmake/PreConfig.cmake.in a bit, to make it easier to add find_package(...) calls similar to these in the future.

Unfortunately the CI will be absolutely blind to these changes. 😦 So the release manager will mainly have to accept the update on good faith...

Cc @pagessin, @tsulaia, @fwinkl.

Edited by Attila Krasznahorkay

Merge request reports