Commit 8dd36b06 authored by Jerome Dias's avatar Jerome Dias
Browse files

[fix] Ensure a unique python system is used

FindPythonLibs or FindPython2 are used by several projects. Both set
some python variables than can enter in conflicts.
This fix ensure the superbuild projects to use the same python version.
It is only needed if a python system is required.
parent 596054a3
......@@ -129,10 +129,30 @@ if (WIN32)
endif()
endif()
if(UNIX AND NOT DEFINED USE_SYSTEM_python2)
# it is still possible to pass -DUSE_SYSTEM_python2=False to cmake
message(STATUS "Defaulting USE_SYSTEM_python2 to True (was undefined and we are on UNIX)")
set(USE_SYSTEM_python2 True CACHE BOOL INTERNAL)
if(UNIX)
if(NOT DEFINED USE_SYSTEM_python2)
# it is still possible to pass -DUSE_SYSTEM_python2=False to cmake
message(STATUS "Defaulting USE_SYSTEM_python2 to True (was undefined and we are on UNIX)")
set(USE_SYSTEM_python2 True CACHE BOOL INTERNAL)
endif()
if(USE_SYSTEM_python2)
# This is needed to ensure the superbuild projects to use the same python version.
# (Only needed when a python system is required)
find_package(Python2 2.7 QUIET REQUIRED COMPONENTS Interpreter Development)
# By setting the following variables we specify a python version for FindPythonLibs
# (See cmake FindPythonLibs documentation)
set(PYTHON_INCLUDE_DIRS ${Python2_INCLUDE_DIRS})
set(PYTHON_INCLUDE_DIR ${Python2_INCLUDE_DIRS})
set(PYTHON_LIBRARY ${Python2_LIBRARIES})
# Python2_INCLUDE_DIR and Python2_LIBRARY are Artefacts in FindPython2
# Both can be used to specific a python version
# (See cmake FindPython2 documentations)
set(Python2_INCLUDE_DIR ${Python2_INCLUDE_DIRS})
set(Python2_LIBRARY ${Python2_LIBRARIES})
endif()
endif()
function (superbuild_add_packaging)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment