FindCUDA: How to pass host compiler flags to nvcc -Xcompiler?
With CMake 3.7, gcc 5.4, CUDA 9 I create a shared library.
CMake looks like
cuda_add_library( NAME SHARED
...
)
set_target_property( NAME
PROPERTY CXX_VISIBILITY_PRESET hidden
)
One effect of this is that CMakeFiles/../flags.cmake contains CXX_FLAGS= .. -fvisibility=hidden
as desired.
However this does not effect the host compilation of nvcc because the -Xcompiler nvcc flag is empty, because ${CUDA_NVCC_HOST_COMPILER_FLAGS}
seems to be empty although CUDA_PROPAGATE_HOST_FLAGS
is On.
Should this be? What would be the way in CMake to tell nvcc to put these flags as option after -Xcompiler. Sorry, a search in the CMake documentation and playing around with CUDA_NVCC_FLAGS
didn't work out.
Edited by Brad King