Skip to content
Snippets Groups Projects
Commit d6f5a044 authored by Andre Sailer's avatar Andre Sailer
Browse files

CMAKE: fix python finding for older cmakes

parent 61ec6740
No related branches found
No related tags found
No related merge requests found
...@@ -651,8 +651,15 @@ macro(DD4HEP_SETUP_ROOT_TARGETS) ...@@ -651,8 +651,15 @@ macro(DD4HEP_SETUP_ROOT_TARGETS)
#Check if Python version detected matches the version used to build ROOT #Check if Python version detected matches the version used to build ROOT
SET(Python_FIND_FRAMEWORK LAST) SET(Python_FIND_FRAMEWORK LAST)
IF((TARGET ROOT::PyROOT OR TARGET ROOT::ROOTTPython) AND ${ROOT_VERSION} VERSION_GREATER_EQUAL 6.19) IF((TARGET ROOT::PyROOT OR TARGET ROOT::ROOTTPython) AND ${ROOT_VERSION} VERSION_GREATER_EQUAL 6.19)
dd4hep_debug( "D++> Python version used for building ROOT ${ROOT_PYTHON_VERSION}" ) # cmake 3.17.1 doesn't include python patch level in PYTHON_VERSION
FIND_PACKAGE(Python ${ROOT_PYTHON_VERSION} EXACT REQUIRED COMPONENTS Development) IF(CMAKE_VERSION VERSION_EQUAL 3.17.1)
string(REGEX MATCH [23]\.[0-9]+ REQUIRE_PYTHON_VERSION ${ROOT_PYTHON_VERSION})
ELSE()
SET(REQUIRE_PYTHON_VERSION ${ROOT_PYTHON_VERSION})
ENDIF()
dd4hep_debug("D++> Python version used for building ROOT ${ROOT_PYTHON_VERSION}" )
dd4hep_debug("D++> Required python version ${REQUIRE_PYTHON_VERSION}")
FIND_PACKAGE(Python ${REQUIRE_PYTHON_VERSION} EXACT REQUIRED COMPONENTS Development)
ELSE() ELSE()
FIND_PACKAGE(Python COMPONENTS Development) FIND_PACKAGE(Python COMPONENTS Development)
ENDIF() ENDIF()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment