diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dd7ec2fa883..e8a66359068a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,31 +1,37 @@ +OPTION(USE_MPI "Enable MPI-based parallel learning" OFF) +OPTION(USE_OPENMP "Enable OpenMP" ON) +OPTION(USE_GPU "Enable GPU-accelerated training" OFF) +OPTION(USE_SWIG "Enable SWIG to generate Java API" OFF) +OPTION(USE_HDFS "Enable HDFS support (EXPERIMENTAL)" OFF) +OPTION(USE_TIMETAG "Set to ON to output time costs" OFF) +OPTION(USE_CUDA "Enable CUDA-accelerated training (EXPERIMENTAL)" 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) +OPTION(__INTEGRATE_OPENCL "Set to ON if building LightGBM with the OpenCL ICD Loader and its dependencies included" OFF) + if(__INTEGRATE_OPENCL) cmake_minimum_required(VERSION 3.11) elseif(USE_GPU OR APPLE) cmake_minimum_required(VERSION 3.2) elseif(USE_CUDA) cmake_minimum_required(VERSION 3.16) +elseif(__BUILD_FOR_R) + cmake_minimum_required(VERSION 3.6) else() cmake_minimum_required(VERSION 3.0) endif() +if(__BUILD_FOR_R) + set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") +endif(__BUILD_FOR_R) + if(USE_CUDA) PROJECT(lightgbm LANGUAGES C CXX CUDA) else() PROJECT(lightgbm LANGUAGES C CXX) endif() -OPTION(USE_MPI "Enable MPI-based parallel learning" OFF) -OPTION(USE_OPENMP "Enable OpenMP" ON) -OPTION(USE_GPU "Enable GPU-accelerated training" OFF) -OPTION(USE_SWIG "Enable SWIG to generate Java API" OFF) -OPTION(USE_HDFS "Enable HDFS support (EXPERIMENTAL)" OFF) -OPTION(USE_TIMETAG "Set to ON to output time costs" OFF) -OPTION(USE_CUDA "Enable CUDA-accelerated training (EXPERIMENTAL)" 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) -OPTION(__INTEGRATE_OPENCL "Set to ON if building LightGBM with the OpenCL ICD Loader and its dependencies included" OFF) - if(APPLE) OPTION(APPLE_OUTPUT_DYLIB "Output dylib shared library" OFF) endif(APPLE)