Yes, you pass values to cmake (that is set cache entries) using the -D VARIABLE=VALUE
or -DVARIABLE=VALUE
syntax.
I doubt the Ubuntu OS itself is the issue – we use that regularly on both desktop and server. It could be that the issue is caused by a combination of the CPU or GPU compiler/toolkits. You mentioned that on the other machines you use gcc 7.4. I suggest start by eliminating the differences between the working and non-working cases, i.e. use the same gcc version, CUDA version and only after that look further.
Also, have you ran the make check
before installation on the machine where you observed issues?