From 8f9133b6f63fa717a9eb8c2c427bc9f530e1d5b4 Mon Sep 17 00:00:00 2001 From: Shogo Hida Date: Sun, 27 Nov 2022 10:39:53 +0900 Subject: [PATCH] [swig] switch to SWIG_ADD_LIBRARY() in CMakeLists.txt (fixes #5586) (#5603) --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f126d659fee2..aea89891ca27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,8 @@ endif() if(__INTEGRATE_OPENCL) cmake_minimum_required(VERSION 3.11) +elseif(USE_SWIG) + cmake_minimum_required(VERSION 3.8) elseif(USE_GPU OR APPLE) cmake_minimum_required(VERSION 3.2) elseif(USE_CUDA OR USE_CUDA_EXP) @@ -457,7 +459,7 @@ if(USE_SWIG) set_property(SOURCE swig/lightgbmlib.i PROPERTY CPLUSPLUS ON) list(APPEND swig_options -package com.microsoft.ml.lightgbm) set_property(SOURCE swig/lightgbmlib.i PROPERTY SWIG_FLAGS "${swig_options}") - swig_add_module(_lightgbm_swig java swig/lightgbmlib.i) + swig_add_library(_lightgbm_swig LANGUAGE java SOURCES swig/lightgbmlib.i) swig_link_libraries(_lightgbm_swig _lightgbm) # needed to ensure Linux build does not have lib prefix specified twice, e.g. liblib_lightgbm_swig set_target_properties(_lightgbm_swig PROPERTIES PREFIX "")