Skip to content

Commit 2e3543c

Browse files
authored
[cmake] [CUDA] ignore CUDA-specific source files in non-CUDA builds (fixes #6267) (#6268)
1 parent 5516533 commit 2e3543c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,10 @@ file(
428428
src/network/*.cpp
429429
src/treelearner/*.cpp
430430
src/utils/*.cpp
431-
if(USE_CUDA)
431+
)
432+
file(
433+
GLOB
434+
LGBM_CUDA_SOURCES
432435
src/treelearner/*.cu
433436
src/boosting/cuda/*.cpp
434437
src/boosting/cuda/*.cu
@@ -442,9 +445,12 @@ if(USE_CUDA)
442445
src/io/cuda/*.cpp
443446
src/cuda/*.cpp
444447
src/cuda/*.cu
445-
endif()
446448
)
447449

450+
if(USE_CUDA)
451+
list(APPEND SOURCES ${LGBM_CUDA_SOURCES})
452+
endif()
453+
448454
add_library(lightgbm_objs OBJECT ${SOURCES})
449455

450456
if(BUILD_CLI)

0 commit comments

Comments
 (0)