Cmake Cuda Compiling Error (Cuda Compiler Idenfitication Is Unknown)

UĞUR ORTAÇ
Thu, 21 Dec 2023 20:36:22 +0000
Usage

Hello,
I’m getting an error while compiling the cmake project I created. I think this error is caused by the internal structure of cmake.

Cmake Version : 3.27.8 (Clion Embedded Compiler)
Cuda Version: 12.3
Nvidia Driver: 545.23.08
OS: Ubuntu 22.04

Can you help me. Thanks.

cmake_minimum_required(VERSION 3.27.8)
project(XProject C CXX)
set(CMAKE_CXX_STANDARD 23)

# Find CUDA package
set(CMAKE_CUDA_ARCHITECTURES 80 86) # For: Ampere and Ada Lovelace
set(CMAKE_CUDA_COMPILER "/usr/local/cuda/bin")
enable_language(CUDA)

cmake/linux/x64/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=linux/x64/ninja -G Ninja
-- The CUDA compiler identification is unknown
-- Check for working CUDA compiler: /usr/local/cuda/bin
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
_CMAKE_CUDA_WHOLE_FLAG
CMake Error at /snap/clion/261/bin/cmake/linux/x64/share/cmake-3.27/Modules/CMakeTestCUDACompiler.cmake:89 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  CMakeLists.txt:30 (enable_language)

3 posts - 2 participants