Make sure any python search finds Python3.

FindCWrap issues another find_package(PythonInterpret).
By setting the PYTHON_EXECUTABLE variable we make sure it
will find python3

This also fixes the CMake confusions about multiple linker paths

```
Make Warning at cmake/Modules/OpmSatellites.cmake:320 (add_executable):
  Cannot generate a safe linker search path for target test_ERft because
  files in some directories may conflict with libraries in implicit
  directories:

    link library [libpython3.7m.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /usr/lib/python3.7/config-3.7m-x86_64-linux-gnu

  Some of these libraries may not be found correctly.
```
This commit is contained in:
Markus Blatt 2021-03-12 16:48:26 +01:00
parent 9a25b78b98
commit af3c825588

View File

@ -165,6 +165,12 @@ if (OPM_ENABLE_PYTHON)
set(Python3_LIBRARIES ${PYTHON_LIBRARIES})
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
# Compatibility settings for PythonInterp and PythonLibs
# used e.g. in FindCwrap
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
set(PYTHON_LIBRARIES Python3::Python)
get_target_property(_lib_path Python3::Python IMPORTED_LOCATION)
set(PYTHON_LIBRARY ${_lib_path})
endif()
if (OPM_ENABLE_EMBEDDED_PYTHON)