Skip to content

Do not rely on relative header lookup for Allen headers

Rosen Matev requested to merge rm-allen-includes into master

The main purpose of this is to allow using CMAKE_INSTALL_MODE=SYMLINK.

The underlying issue is that the Allen sources (incl. headers) are organised in a non-standard way (Allen#485). In particular headers are not "namespaced" in directories like in the rest of the LHCb code. In the build of Allen itself, this is handled by adding many directives such as

target_include_directories(LHCbEvent INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/daq40>)

Most headers are then installed in a flat directory

$ ll ~/stack/Allen/InstallArea/x86_64_v2-el9-gcc12-dbg/include/Allen
...
-rw-r--r-- 1 rmatev hlt 2.8K Jul 11  2023 BankMapping.h
...
-rw-r--r-- 1 rmatev hlt 1.9K Jun 26  2023 sourceid.h
...

In MooreOnline, in order to include BankMapping we need to refer to the namespaced path:

~/stack/MooreOnline/AllenOnline/include/AllenOnline/TransposeMEP.h
    #include <Allen/BankMapping.h>

However BankMapping.h does an include like so:

~/stack/Allen/main/include/BankMapping.h
    #include "sourceid.h"

which happens to work only because the preprocessor looks for headers in the same directory, and not only in the include paths given on the command line (BankMapping.h and sourceid.h are installed in the same directory).

This breaks down when the files in InstallArea are not copies but symlinks, because then, "same directory" is the directory of the symlink target and not the symlink itself.

The solution is to explicitly add the subdirectory InstallArea/x86_64_v2-el9-gcc12-dbg/include/Allen to the target include directories.

/cc @raaij

Merge request reports