NGSolve / netgen

https://ngsolve.org
GNU Lesser General Public License v2.1
298 stars 131 forks source link

How to choose a specific Python to be used rather than allowing CMake to pick what it likes? #174

Open barracuda156 opened 10 months ago

barracuda156 commented 10 months ago

The build picks Python at random, ignoring configure args like -DPYTHON_EXECUTABLE=, -DPYTHON3_EXECUTABLE= and whatever I tried so far.

This is rather a CMake bug, but maybe a configure option can be provided to select a specific Python rather than relying on a defunct CMake module? See, for instance: https://gitlab.kitware.com/cmake/cmake/-/issues/23139

barracuda156 commented 10 months ago

Okay, this works:

if(USE_PYTHON)
  if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18)
      find_package(Python3 3.11 REQUIRED EXACT COMPONENTS Development.Module)
      find_package(Python3 3.11 EXACT COMPONENTS Interpreter Development.Embed)
  else()
    find_package(Python3 3.11 REQUIRED EXACT COMPONENTS Interpreter Development)
  endif()