oneMKL
                                
                                 oneMKL copied to clipboard
                                
                                    oneMKL copied to clipboard
                            
                            
                            
                        [CMake][DFT] target_link_library(myTarget PRIVATE MKL::onemkl_dft_XXX) does not add includes
Summary
The oneMKL interface library supports linking the the DFT backends (to allow for compile-time dispatch) instead of linking to the main library itself and using the dynamic dispatch mechanism. There are examples of using oneMKL in this way in the examples.
However, the CMake in the examples does is not representative of oneMKL usage after installation.
Observed behavior
Using the example of the MKLGPU backend, I'd expect to the following:
        target_link_libraries(libgromacs PRIVATE MKL::onemkl_dft_mklgpu)
to also include the MKL header files. e.g. I'd expect to able to #include <oneapi/mkl/dft.hpp>. However, without additional cmake, this header is not available.
Expected behavior
I think the DFT backends targets should include the relevent headers as part of their interface.
Version
Report oneMKL version: develop tip: f5dc527
Environment
DPC++ 2024.0 Ubuntu20
Steps to reproduce
CMake:
cmake_minimum_required(VERSION 3.26)
project(exampleProject)
add_executable(myapp main.cpp)
find_package(oneMKL REQUIRED)
# target_link_libraries(myapp PRIVATE MKL::onemkl)
target_link_libraries(myapp PRIVATE MKL::onemkl_dft_mklgpu)
C++
#include <oneapi/mkl/dft.hpp>
int main(){ return 0; }
Gives:
FAILED: CMakeFiles/myapp.dir/main.cpp.o
/opt/intel/oneapi/compiler/2024.0/bin/icpx   -fsycl -MD -MT CMakeFiles/myapp.dir/main.cpp.o -MF CMakeFiles/myapp.dir/main.cpp.o.d -o CMakeFiles/myapp.dir/main.cpp.o -c /home/hugh/tmp/example/main.cpp
/home/hugh/tmp/example/main.cpp:1:10: fatal error: 'oneapi/mkl/dft.hpp' file not found
    1 | #include <oneapi/mkl/dft.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
1 error generated.