Skip to content

Commit

Permalink
Adding static library option (#3171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darby Payne authored Jun 26, 2020
1 parent be85f56 commit 2e2757f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ OPTION(USE_HDFS "Enable HDFS support (EXPERIMENTAL)" OFF)
OPTION(USE_R35 "Set to ON if your R version is not earlier than 3.5" OFF)
OPTION(USE_TIMETAG "Set to ON to output time costs" OFF)
OPTION(USE_DEBUG "Set to ON for Debug mode" OFF)
option(BUILD_STATIC_LIB "Build static library" OFF)
OPTION(BUILD_FOR_R "Set to ON if building lib_lightgbm for use with the R package" OFF)

if(APPLE)
Expand Down Expand Up @@ -243,7 +244,11 @@ if(BUILD_FOR_R)
list(APPEND SOURCES "src/lightgbm_R.cpp")
endif(BUILD_FOR_R)

add_library(_lightgbm SHARED ${SOURCES})
if (BUILD_STATIC_LIB)
add_library(_lightgbm STATIC ${SOURCES})
else()
add_library(_lightgbm SHARED ${SOURCES})
endif(BUILD_STATIC_LIB)

if(MSVC)
set_target_properties(_lightgbm PROPERTIES OUTPUT_NAME "lib_lightgbm")
Expand Down

0 comments on commit 2e2757f

Please sign in to comment.