Skip to content
Snippets Groups Projects
Commit 25e4ec76 authored by Julien Osman's avatar Julien Osman
Browse files

BUG: Looking for python only when OTB_WRAP_PYTHON is enabled

parent 1a9767d7
No related branches found
No related tags found
No related merge requests found
......@@ -101,35 +101,37 @@ reset_qt_i18n_sources()
repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE)
# Find python stuff
# Version 3 is preferred before 2
if(CMAKE_VERSION VERSION_LESS 3.12.0)
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
find_package( PythonInterp )
if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
endif()
# Now that we have a python version the addditional versions should only
# contain the version we have to get the corresponding libs
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
else()
if(WIN32)
set(Python_ROOT_DIR "C:/tools/Python37-x64")
endif()
find_package(Python REQUIRED COMPONENTS Interpreter Development)
if(Python_FOUND)
message(STATUS "Python Library directory : ${Python_LIBRARY_DIRS}")
message(STATUS "Python Headers directory : ${Python_INCLUDE_DIRS}")
#For compatibility reason, we have to define these variables
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
set(PYTHON_LIBRARY_DIR ${Python_LIBRARY_DIRS})
set(PYTHON_VERSION_STRING ${Python_VERSION})
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
if(OTB_WRAP_PYTHON)
# Find python stuff
# Version 3 is preferred before 2
if(CMAKE_VERSION VERSION_LESS 3.12.0)
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
find_package( PythonInterp )
if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
endif()
# Now that we have a python version the addditional versions should only
# contain the version we have to get the corresponding libs
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
else()
if(WIN32)
set(Python_ROOT_DIR "C:/tools/Python37-x64")
endif()
find_package(Python REQUIRED COMPONENTS Interpreter Development)
if(Python_FOUND)
message(STATUS "Python Library directory : ${Python_LIBRARY_DIRS}")
message(STATUS "Python Headers directory : ${Python_INCLUDE_DIRS}")
#For compatibility reason, we have to define these variables
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
set(PYTHON_LIBRARY_DIR ${Python_LIBRARY_DIRS})
set(PYTHON_VERSION_STRING ${Python_VERSION})
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
endif()
endif()
endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment