Skip to content

Commit 4e83702

Browse files
authored
Properly link and generate config for Python 3 (#100)
* Generation of ReadoutCardConfig.cmake is now fixed and detects Python 3 and `boost_pythonXY` properly * Target `libReadoutCard.*` now gets correctly linked to the Python 3 libraries as well
1 parent e91db2b commit 4e83702

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ target_link_libraries(ReadoutCard
155155
AliceO2::Common
156156
$<$<BOOL:${Python2_FOUND}>:Boost::python27>
157157
$<$<BOOL:${Python2_FOUND}>:Python2::Python>
158+
$<$<BOOL:${Python3_FOUND}>:Boost::python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}>
159+
$<$<BOOL:${Python3_FOUND}>:Python3::Python>
158160
PRIVATE
159161
$<$<BOOL:${PDA_FOUND}>:pda::pda>
160162
Boost::filesystem

cmake/ReadoutCardConfig.cmake.in

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ set(Common_CMAKE_DIR @Common_DIR@)
77
set(InfoLogger_CMAKE_DIR @InfoLogger_ROOT@)
88

99
if(NOT APPLE)
10-
set(boost_python_component "python27")
11-
find_dependency(Python2 2.7 COMPONENTS Development REQUIRED)
10+
find_package(Python3 3.6 COMPONENTS Development)
11+
if(Python3_FOUND)
12+
set(boost_python_component "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
13+
else()
14+
# Backwards compatible. Can be removed once the Python3 recipe is stable
15+
message(WARNING "Python 3 was not found: falling back to Python 3")
16+
find_package(Python2 2.7 COMPONENTS Development REQUIRED)
17+
set(boost_python_component "python27")
18+
endif()
1219
endif()
1320

1421
find_dependency(Common CONFIG HINTS ${Common_CMAKE_DIR})

0 commit comments

Comments
 (0)