lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
944 stars 385 forks source link

Pick up python3 whenever possible #433

Closed nosracd closed 1 year ago

nosracd commented 1 year ago

This PR resolves #431 by dropping cmake/FindPython.cmake in favor of cmake's FindPython module. This means that cmake will pick up python3 over python2 even if python points to python2. The disadvantage of this approach is that it means LCM requires cmake 3.12 to build, since that's when cmake's FindPython was added. Also, if python3-dev is not installed but python2-dev and python-is-python2 are installed, then it produces a weird result:

-- Found Python: /usr/bin/python3.8 (found version "3.8.10") found components: Interpreter 
-- Could NOT find Python (missing: Interpreter) (found version "2.7")
CMake Error at lcm-python/CMakeLists.txt:41 (message):
  /usr/lib/x86_64-linux-gnu/libpython2.7.so

although it appears the python module still builds OK.