Skip to content

Instantly share code, notes, and snippets.

@ludwigschwardt
Last active May 17, 2019 12:13
Show Gist options
  • Save ludwigschwardt/bfbe9dd2538abbbf22552fde40bec935 to your computer and use it in GitHub Desktop.
Save ludwigschwardt/bfbe9dd2538abbbf22552fde40bec935 to your computer and use it in GitHub Desktop.
casacore/casacore#846: Boost Python library name now has pythonxy suffix
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index f8ece25..db824fd 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -22,7 +22,23 @@ set(Python_FIND_VERSION 2)
set(PythonInterp_FIND_VERSION_MAJOR 2)
find_package(Python REQUIRED)
if (PYTHONINTERP_FOUND)
- find_package(Boost REQUIRED COMPONENTS python)
+ find_package(Boost REQUIRED)
+ if (${Boost_MAJOR_VERSION} STREQUAL 1 AND ${Boost_MINOR_VERSION} STRGREATER 66)
+ # Boost>=1.67 Python components require a Python version suffix
+ set(BOOST_PYTHON_LIBRARY_NAME
+ python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}
+ CACHE
+ FILEPATH
+ "The name of the boost python library to search for")
+ else ()
+ set(BOOST_PYTHON_LIBRARY_NAME
+ python
+ CACHE
+ FILEPATH
+ "The name of the boost python library to search for")
+ endif ()
+ find_package(Boost REQUIRED COMPONENTS ${BOOST_PYTHON_LIBRARY_NAME})
+
find_package (NUMPY REQUIRED)
# copy the variables to their final destination
diff --git a/python3/CMakeLists.txt b/python3/CMakeLists.txt
index 4300365..5ad72bc 100644
--- a/python3/CMakeLists.txt
+++ b/python3/CMakeLists.txt
@@ -18,17 +18,27 @@ if (PYTHON3_FIND_PACKAGE_MESSAGE_DETAILS_PythonLibs)
endif()
# Detect the python properties
-set(Python_ADDITIONAL_VERSIONS 3.5 3.4)
+set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4)
find_package(Python REQUIRED)
if (PYTHONINTERP_FOUND)
- if (APPLE)
- find_package(Boost REQUIRED COMPONENTS python3)
+ find_package(Boost REQUIRED)
+ if (${Boost_MAJOR_VERSION} STREQUAL 1 AND ${Boost_MINOR_VERSION} STRGREATER 66)
+ # Boost>=1.67 Python components require a Python version suffix
+ set(BOOST_PYTHON3_LIBRARY_NAME
+ python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}
+ CACHE
+ FILEPATH
+ "The name of the boost python3 library to search for")
else ()
- # NOTE: the name of the python3 version of boost is probably Debian/Ubuntu specific
- find_package(Boost REQUIRED COMPONENTS python-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
- endif (APPLE)
+ set(BOOST_PYTHON3_LIBRARY_NAME
+ python${PYTHON_VERSION_MAJOR}
+ CACHE
+ FILEPATH
+ "The name of the boost python library to search for")
+ endif ()
+ find_package(Boost REQUIRED COMPONENTS ${BOOST_PYTHON3_LIBRARY_NAME})
find_package (NUMPY REQUIRED)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment