I have a project using the FFTW3 library and also trying to detect if the Intel MKL library is present. If it is present, I want to link the MKL before I link the FFTW library to enable the FFTW library to use the MKL. I have written a small FindMKL cmake script to create an MKL target to add to my target_link_libraries() line. The Find script defines an INTERFACE library for the MKL and an alias to that library.
No matter what I do, I am unable to change the link order of the underlying MKL shared library relative the FFTW library. The MKL library is always prepended to the link line, keeping the FFTW library from using the MKL routines.
What is the solution to this? Are INTERFACE libraries always prepended to the linker’s options? I found a similar issue on the forum with link flags, but this is an actual link library to be linked in. Should I be treating this as a flag?