Skip to content

Commit e91db2b

Browse files
authored
Add support for Python 3 (backwards-compat) (#99)
* Works with the current recipes set (using Python 2) * Will automatically use Python 3 (both from system and from our custom stack when alisw/alidist#1589 is ready
1 parent b027d9f commit e91db2b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,15 @@ ENDIF()
5858
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
5959

6060
if(NOT APPLE)
61-
set(boost_python_component "python27")
62-
find_package(Python2 2.7 COMPONENTS Development)
61+
find_package(Python3 3.6 COMPONENTS Development)
62+
if(Python3_FOUND)
63+
set(boost_python_component "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
64+
else()
65+
# Backwards compatible. Can be removed once the Python3 recipe is stable
66+
message(WARNING "Python 3 was not found: falling back to Python 3")
67+
find_package(Python2 2.7 COMPONENTS Development REQUIRED)
68+
set(boost_python_component "python27")
69+
endif()
6370
endif()
6471

6572
find_package(Boost 1.56

0 commit comments

Comments
 (0)