Skip to content

Ensure source/build paths appear first in CUDA compilation

Benjamin Morgan requested to merge bmorgan/include-path-order into master

Reported by @jlima: If a VecGeom install is present in a path that's added to include_directories, this will appear first in the set of -I paths passed to nvcc. These will be found/used in place of the project local ones, causing compile errors.

Triaged to FindCUDA not respecting the CMake variable CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE when creating the overall include paths.

Call cuda_include_directories with project source and binary directories before cuda_add_library to ensure these are at the front on the include search path for nvcc. Minor hack as cuda_include_directories is usually intended for .cu/.cuh files. Temporary until migration to CMake native CUDA support.

Should not cause issues in testing, but @jlima should confirm this fixes his issue before merging!

Merge request reports