Skip to content

Commit

Permalink
Merge pull request #1325 from gergondet/topic/FixPythonVersionDetection
Browse files Browse the repository at this point in the history
Fallback to python2 if python is not Python 2
  • Loading branch information
fkanehiro authored Dec 15, 2022
2 parents 0e13702 + 9e32acb commit 7926d0f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,18 @@ endif()
execute_process(
COMMAND python -c "from distutils import sysconfig; print sysconfig.get_config_var(\"VERSION\")"
OUTPUT_VARIABLE PYTHON_VERSION
RESULT_VARIABLE PYTHON_VERSION_SUCCESS
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT PYTHON_VERSION_SUCCESS STREQUAL 0)
execute_process(
COMMAND python2 -c "from distutils import sysconfig; print sysconfig.get_config_var(\"VERSION\")"
OUTPUT_VARIABLE PYTHON_VERSION
RESULT_VARIABLE PYTHON_VERSION_SUCCESS
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT PYTHON_VERSION_SUCCESS STREQUAL 0)
message(FATAL_ERROR "Could not determine Python 2 version, maybe it is not installed?")
endif()
endif()
set(python_dist_pkg_dir lib/python${PYTHON_VERSION}/dist-packages)

configure_file(hrpsys-base.pc.in ${CMAKE_CURRENT_BINARY_DIR}/hrpsys-base.pc @ONLY)
Expand Down

0 comments on commit 7926d0f

Please sign in to comment.