Suppress CMake warning about CUDA architectures
I'm getting warnings that CMAKE_CUDA_ARCHITECTURES is not set.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in apps/tutorials/cuda/CMakeLists.txt:
Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104"
for policy details. Use the cmake_policy command to set the policy and
suppress this warning.
CUDA_ARCHITECTURES is empty for target "01_GameOfLife_cuda".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in apps/showcases/PhaseFieldAllenCahn/GPU/CMakeLists.txt:
Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104"
for policy details. Use the cmake_policy command to set the policy and
suppress this warning.
CUDA_ARCHITECTURES is empty for target "multiphase".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in apps/showcases/PhaseFieldAllenCahn/GPU/CMakeLists.txt:
Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104"
for policy details. Use the cmake_policy command to set the policy and
suppress this warning.
CUDA_ARCHITECTURES is empty for target "PhaseFieldCodeGenGPU".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in apps/showcases/PhaseFieldAllenCahn/GPU/CMakeLists.txt:
Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104"
for policy details. Use the cmake_policy command to set the policy and
suppress this warning.
CUDA_ARCHITECTURES is empty for target "PhaseFieldCodeGenGPU".
This warning is for project developers. Use -Wno-dev to suppress it.
CMP0104
-------
Initialize ``CMAKE_CUDA_ARCHITECTURES`` when
``CMAKE_CUDA_COMPILER_ID`` is ``NVIDIA``.
Raise an error if ``CUDA_ARCHITECTURES`` is empty.
``CMAKE_CUDA_ARCHITECTURES`` introduced in CMake 3.18 is used to
initialize ``CUDA_ARCHITECTURES``, which passes correct code generation
flags to the CUDA compiler.
Previous to this users had to manually specify the code generation flags. This
policy is for backwards compatibility with manually specifying code generation
flags.
The ``OLD`` behavior for this policy is to not initialize
``CMAKE_CUDA_ARCHITECTURES`` when
``CMAKE_CUDA_COMPILER_ID`` is ``NVIDIA``.
Empty ``CUDA_ARCHITECTURES`` is allowed.
The ``NEW`` behavior of this policy is to initialize
``CMAKE_CUDA_ARCHITECTURES`` when
``CMAKE_CUDA_COMPILER_ID`` is ``NVIDIA``
and raise an error if ``CUDA_ARCHITECTURES`` is empty during generation.
If ``CUDA_ARCHITECTURES`` is set to a false value no architectures
flags are passed to the compiler. This is intended to support packagers and
the rare cases where full control over the passed flags is required.
This policy was introduced in CMake version 3.18. CMake version
3.18.2 warns when the policy is not set and uses ``OLD`` behavior.
Use the ``cmake_policy()`` command to set it to ``OLD`` or ``NEW``
explicitly.
.. note::
The ``OLD`` behavior of a policy is
``deprecated by definition``
and may be removed in a future version of CMake.
Examples
^^^^^^^^
set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES 35 50 72)
Generates code for real and virtual architectures ``30``, ``50`` and ``72``.
set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES 70-real 72-virtual)
Generates code for real architecture ``70`` and virtual architecture ``72``.
set_property(TARGET tgt PROPERTY CUDA_ARCHITECTURES OFF)
CMake will not pass any architecture flags to the compiler.