You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I always have to pass a lot of explicit variable definitions to CMake and wonder if there are better configuration macros nowadays.
From what I can see, we introduced quite some custom configuration code back then in order to work around limitations of the default macros coming with CMake, but CMake has improved a lot in the meantime.
For instance, there is this comment:
# 'FIND_PACKAGE(Boost COMPONENTS python)' is unreliable because it often selects
# boost_python for the wrong Python version
followed by 160 LOC of a workaround, and the python libraries themselves are also detected with custom routines, following
# 'FIND_PACKAGE(PythonLibs)' is unreliable because results are often inconsistent
# with the Python interpreter found previously (e.g. libraries or includes
# from incompatible installations). Thus, we ask Python itself for the information.
If calling both find_package(PythonInterp) and find_package(PythonLibs), call find_package(PythonInterp) first to get the currently active Python version by default with a consistent version of PYTHON_LIBRARIES.
indicating that that should no longer be necessary. Furthermore, PythonInterp+PythonLibs are deprecated in favor of Python3 (requiring CMake 3.12, which is not much more than 3.10 which we have been specifying as minimum version since March 2021).
So, I tried the default macros out, and while it feels better to have less code, I did not have more success with it. In particular, while FindPython3 supports more attractive COMPONENTS including "Numpy", it fails to detect my MacPorts-installed NumPy. (Our old code using numpy.distutils robustly does the detection, but throws a deprecation warning, because numpy.distutils will be removed following the deprecation of distutils itself, so we will eventually need an alternative.)
I always have to pass a lot of explicit variable definitions to CMake and wonder if there are better configuration macros nowadays.
From what I can see, we introduced quite some custom configuration code back then in order to work around limitations of the default macros coming with CMake, but CMake has improved a lot in the meantime.
For instance, there is this comment:
followed by 160 LOC of a workaround, and the python libraries themselves are also detected with custom routines, following
When looking at https://cmake.org/cmake/help/latest/module/FindPythonLibs.html, it nowadays states
indicating that that should no longer be necessary. Furthermore, PythonInterp+PythonLibs are deprecated in favor of Python3 (requiring CMake 3.12, which is not much more than 3.10 which we have been specifying as minimum version since March 2021).
Finally, https://cmake.org/cmake/help/latest/module/FindBoost.html has an example section that suggests that one can also specify the required python version:
so hopefully all previous issues with the default scripts are solved.
The text was updated successfully, but these errors were encountered: