Skip to content

Commit

Permalink
Fallback to python2 if python is not python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
gergondet committed Dec 15, 2022
1 parent 0e13702 commit 9e32acb
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 9e32acb

Please sign in to comment.