Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[swig] switch to SWIG_ADD_LIBRARY() in CMakeLists.txt #5586

Closed
jameslamb opened this issue Nov 14, 2022 · 2 comments · Fixed by #5603
Closed

[swig] switch to SWIG_ADD_LIBRARY() in CMakeLists.txt #5586

jameslamb opened this issue Nov 14, 2022 · 2 comments · Fixed by #5603

Comments

@jameslamb
Copy link
Collaborator

Summary

Starting with cmake 3.8, compilation of SWIG targets for LightGBM raises the following deprecation warning.

CMake Deprecation Warning at /usr/local/share/cmake-3.23/Modules/UseSWIG.cmake:734 (message):
  SWIG_ADD_MODULE is deprecated.  Use SWIG_ADD_LIBRARY instead.
Call Stack (most recent call first):
  CMakeLists.txt:460 (swig_add_module)

The project should be modified to avoid that warning.

Motivation

Removes a warning in compilation logs, reducing the risk of other important information being missed.

Reduces the risk of LightGBM SWIG compilation failing on future releases of CMake where SWIG_ADD_MODULE() is removed.

Description

  1. Replace uses of SWIG_ADD_MODULE() in CMakeLists.txt with SWIG_ADD_LIBRARY().

  2. the minimum required version for CMake should be increased to 3.8 when compiling the SWIG targets.

LightGBM/CMakeLists.txt

Lines 28 to 36 in f1d3181

if(__INTEGRATE_OPENCL)
cmake_minimum_required(VERSION 3.11)
elseif(USE_GPU OR APPLE)
cmake_minimum_required(VERSION 3.2)
elseif(USE_CUDA OR USE_CUDA_EXP)
cmake_minimum_required(VERSION 3.16)
else()
cmake_minimum_required(VERSION 3.0)
endif()

References

SWIG_ADD_LIBRARY() has been available since CMake 3.8 (docs link), which was released in November 2018 (release details).

@shogohida
Copy link
Contributor

Hi @jameslamb, I made a pull request which fixes this issue. Please take a look!

#5603

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed.
To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues
including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants