Extend cmake scripts to avoid compilation issues with certain versions of libcerf (e.g. 1.11)
In this MR the cmake scripts have been extended to try to workaround compilation issues regarding libcerf.
Background: certain versions of libcerf do not require a typedef
for _cerf_cmplx
because a #define
for the type is made in the header cerf.h
. If a typedef
is made the build aborts with an error. This happens with version 1.11 but earlier versions (1.3) and later versions (1.14) are not affected. (Other versions than the three mentioned were not examined.)
As solution, during the configuration stage of cmake, an attempt is made to compile a very small program using libcerf. If that fails a second attempt is made, this time without the typedef
. This way it is determined if the typedef
is needed or not.
Other thoughts: the test was added to cmake/BornAgain/Dependencies.cmake
and not cmake/find/FindCerf.cmake
because I thought that it is not an issue about libcerf in general but rather about how 3rdparty/Core/cerfcpp.h
uses libcerf. But that can be discussed. Also whether the source code for the test should be placed somewhere else than cmake/tests
can be discussed.