diff --git a/CMakeLists.txt b/CMakeLists.txt index b5ae0435055b..1d1d8d585ae4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -235,12 +235,12 @@ file(GLOB SOURCES ) add_executable(lightgbm src/main.cpp ${SOURCES}) -set(SOURCES "${SOURCES} src/c_api.cpp") +list(APPEND SOURCES "src/c_api.cpp") # Only build the R part of the library if building for # use with the R package if(BUILD_FOR_R) - set(SOURCES "${SOURCES} src/lightgbm_R.cpp") + list(APPEND SOURCES "src/lightgbm_R.cpp") endif(BUILD_FOR_R) add_library(_lightgbm SHARED ${SOURCES})