Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
77521f73
Commit
77521f73
authored
13 years ago
by
Andreas Schenk
Browse files
Options
Downloads
Patches
Plain Diff
extended _find_python_binary to make sure the binary matches the library version
parent
699807da
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmake_support/FindPython.cmake
+37
-15
37 additions, 15 deletions
cmake_support/FindPython.cmake
with
37 additions
and
15 deletions
cmake_support/FindPython.cmake
+
37
−
15
View file @
77521f73
...
...
@@ -70,22 +70,44 @@ endmacro()
macro
(
_find_python_bin PYTHON_ROOT VERSION
)
string
(
REPLACE
"."
""
_VERSION_NO_DOTS
${
VERSION
}
)
if
(
PYTHON_ROOT
)
find_program
(
PYTHON_BINARY
NAMES
"python"
"python
${
_VERSION_NO_DOTS
}
"
"python
${
VERSION
}
"
HINTS
"
${
PYTHON_ROOT
}
"
PATH_SUFFIXES bin
NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
)
else
()
find_program
(
PYTHON_BINARY
NAMES
"python"
"python
${
_VERSION_NO_DOTS
}
"
"python
${
VERSION
}
"
HINTS
"
${
CMAKE_PREFIX_PATH
}
"
PATH_SUFFIXES bin
)
endif
()
foreach
(
_NAME
"python"
"python
${
_VERSION_NO_DOTS
}
"
"python
${
VERSION
}
"
)
if
(
PYTHON_ROOT
)
find_program
(
PYTHON_BINARY
NAMES
${
_NAME
}
HINTS
"
${
PYTHON_ROOT
}
"
PATH_SUFFIXES bin
NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
)
if
(
PYTHON_BINARY
)
execute_process
(
COMMAND
${
PYTHON_BINARY
}
-V
OUTPUT_VARIABLE PY_VERSION
ERROR_VARIABLE PY_VERSION
)
if
(
PY_VERSION MATCHES
${
VERSION
}
)
break
()
else
()
unset
(
PYTHON_BINARY CACHE
)
endif
()
endif
()
else
()
find_program
(
PYTHON_BINARY
NAMES $_NAME
HINTS
"
${
CMAKE_PREFIX_PATH
}
"
PATH_SUFFIXES bin
)
if
(
PYTHON_BINARY
)
execute_process
(
COMMAND
${
PYTHON_BINARY
}
-V
OUTPUT_VARIABLE PY_VERSION
ERROR_VARIABLE PY_VERSION
)
if
(
${
PY_VERSION
}
matches
${
VERSION
}
)
break
()
else
()
unset
(
PYTHON_BINARY CACHE
)
endif
()
endif
()
endif
()
endforeach
()
endmacro
()
#-------------------------------------------------------------------------------
# check for python lib
#
...
...
@@ -114,7 +136,7 @@ macro(check_for_python_binary)
foreach
(
_VERSION
${
PYTHON_VERSIONS
}
)
if
(
${
PYTHON_MIN_VERSION
}
VERSION_LESS
${
_VERSION
}
)
_find_python_bin
(
"
${
PYTHON_ROOT
}
"
"
${
_VERSION
}
"
)
if
(
PYTHON_
LIBRARIES
)
if
(
PYTHON_
BINARY
)
set
(
PYTHON_VERSION
"
${
_VERSION
}
"
)
break
()
endif
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment