lattice / quda

QUDA is a library for performing calculations in lattice QCD on GPUs.
https://lattice.github.io/quda
Other
287 stars 94 forks source link

Update CMakeLists.txt in the test directory to only `try_compile` `c_interface_test` #1371

Open weinbe2 opened 1 year ago

weinbe2 commented 1 year ago

Right now, c_interface_test is fully compiled and linked as part of the compile workflow. Since the only purpose of this test is to confirm that quda.h contains only "legal C code", there's no point in doing the full link. This dependency as it stands leads to link-time workarounds akin to what's in #1370 .

The more robust way to handle this is to use a try_compile command, as documented in https://cmake.org/cmake/help/v3.18/command/try_compile.html#try-compiling-source-files (or newer; cmake 3.25 in particular adds some nice debugging features on top of this apparently). This eliminates the need for workarounds, and in the case of the workaround above, eliminates a need to "bake in" a specific c++ library.

mathiaswagner commented 1 year ago

Maybe we should check https://cmake.org/cmake/help/latest/prop_tgt/LINKER_LANGUAGE.html instead of using the WAR in #1370.