Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ipythonxiaobo
otb
Commits
25e4ec76
Commit
25e4ec76
authored
Nov 05, 2021
by
Julien Osman
Browse files
BUG: Looking for python only when OTB_WRAP_PYTHON is enabled
parent
1a9767d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
25e4ec76
...
...
@@ -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
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment