[PR #747] Fix unknown CMake command "cuda_add_library" in CMakeLists.txt #752

Open
opened 2026-10-27 21:05:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepEP/pull/747
Author: @PerryLink
Created: 9/10/2026
Status: 🔄 Open

Base: main ← Head: fix/undefined-cuda-add-library


📝 Commits (1)

  • d2d0b56 Fix unknown CMake command "cuda_add_library" in CMakeLists.txt

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 CMakeLists.txt (+1 -1)

📄 Description

CMakeLists.txt line 52 calls cuda_add_library(), a macro that only exists after find_package(CUDA). The file never does that — it only calls find_package(CUDAToolkit) on line 21 — so configure aborts with:

Unknown CMake command "cuda_add_library".

Reproduction

On CMake 4.4.3, with no CUDA toolkit and no torch required:

cmake_minimum_required(VERSION 3.18)
project(repro LANGUAGES CXX)
find_package(CUDAToolkit QUIET)                                          # line 21's call
cuda_add_library(deep_ep_indexing_cuda STATIC csrc_indexing_main.cu)     # line 52
CMake Error at CMakeLists.txt:8 (cuda_add_library):
  Unknown CMake command "cuda_add_library".

Fix

-cuda_add_library(deep_ep_indexing_cuda STATIC csrc/indexing/main.cu)
+add_library(deep_ep_indexing_cuda STATIC csrc/indexing/main.cu)

CUDA is already listed in project(... LANGUAGES CXX CUDA), so csrc/indexing/main.cu is still compiled by nvcc without FindCUDA. No runtime behavior changes — this only makes the IDE-indexing target configurable.

I did not add find_package(CUDA) instead: it is deprecated since CMake 3.10, and under CMP0146=NEW it defines nothing, so the error comes straight back.

Verification

Same reduced case with the one-line change:

-- Configuring done (6.1s)
-- Generating done (0.2s)

Out of scope

The same FindCUDA-era leftovers appear elsewhere in the file and are no-ops on the native CUDA-language path: CUDA_SEPARABLE_COMPILATION and CUDA_NVCC_FLAGS (lines 8-15), and CUDA_TOOLKIT_ROOT_DIR (lines 41-42), which is empty here so those include/link dirs resolve relative. I left them alone to keep this to one line — happy to send that as a separate PR.

Base branch

Targeting main: CMakeLists.txt does not exist on hybrid-ep, and main is where build/packaging fixes have landed before (#351, #627, #640).

For transparency: the same one-line defect also exists in deepseek-ai/DeepGEMM's CMakeLists.txt, and I opened deepseek-ai/DeepGEMM#437 for it there.

cc @LyricZhao — you added this file in b306af06.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/deepseek-ai/DeepEP/pull/747 **Author:** [@PerryLink](https://github.com/PerryLink) **Created:** 9/10/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/undefined-cuda-add-library` --- ### 📝 Commits (1) - [`d2d0b56`](https://github.com/deepseek-ai/DeepEP/commit/d2d0b56715747639863a5d18af6227f36d52b4cb) Fix unknown CMake command "cuda_add_library" in CMakeLists.txt ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+1 -1) </details> ### 📄 Description `CMakeLists.txt` line 52 calls `cuda_add_library()`, a macro that only exists after `find_package(CUDA)`. The file never does that — it only calls `find_package(CUDAToolkit)` on line 21 — so configure aborts with: ``` Unknown CMake command "cuda_add_library". ``` ### Reproduction On CMake 4.4.3, with no CUDA toolkit and no torch required: ```cmake cmake_minimum_required(VERSION 3.18) project(repro LANGUAGES CXX) find_package(CUDAToolkit QUIET) # line 21's call cuda_add_library(deep_ep_indexing_cuda STATIC csrc_indexing_main.cu) # line 52 ``` ``` CMake Error at CMakeLists.txt:8 (cuda_add_library): Unknown CMake command "cuda_add_library". ``` ### Fix ```diff -cuda_add_library(deep_ep_indexing_cuda STATIC csrc/indexing/main.cu) +add_library(deep_ep_indexing_cuda STATIC csrc/indexing/main.cu) ``` `CUDA` is already listed in `project(... LANGUAGES CXX CUDA)`, so `csrc/indexing/main.cu` is still compiled by nvcc without `FindCUDA`. No runtime behavior changes — this only makes the IDE-indexing target configurable. I did not add `find_package(CUDA)` instead: it is deprecated since CMake 3.10, and under `CMP0146=NEW` it defines nothing, so the error comes straight back. ### Verification Same reduced case with the one-line change: ``` -- Configuring done (6.1s) -- Generating done (0.2s) ``` ### Out of scope The same `FindCUDA`-era leftovers appear elsewhere in the file and are no-ops on the native CUDA-language path: `CUDA_SEPARABLE_COMPILATION` and `CUDA_NVCC_FLAGS` (lines 8-15), and `CUDA_TOOLKIT_ROOT_DIR` (lines 41-42), which is empty here so those include/link dirs resolve relative. I left them alone to keep this to one line — happy to send that as a separate PR. ### Base branch Targeting `main`: `CMakeLists.txt` does not exist on `hybrid-ep`, and `main` is where build/packaging fixes have landed before (#351, #627, #640). For transparency: the same one-line defect also exists in `deepseek-ai/DeepGEMM`'s `CMakeLists.txt`, and I opened deepseek-ai/DeepGEMM#437 for it there. cc @LyricZhao — you added this file in `b306af06`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepEP#752
No description provided.