efc4eb3
diff -up ./python/CMakeLists.txt.boostpython ./python/CMakeLists.txt
efc4eb3
--- ./python/CMakeLists.txt.boostpython	2019-07-02 21:54:36.203930566 -0400
efc4eb3
+++ ./python/CMakeLists.txt	2019-07-02 21:56:15.787376502 -0400
efc4eb3
@@ -1,40 +1,39 @@
efc4eb3
 # Find the Python libraries and headers
efc4eb3
 SET (TARGET_PYTHON_VERSION 3)
efc4eb3
-FIND_PACKAGE (PythonLibs ${TARGET_PYTHON_VERSION})
efc4eb3
-if (NOT PYTHON_LIBRARIES)
efc4eb3
+FIND_PACKAGE (Python3 COMPONENTS Development)
efc4eb3
+if (NOT Python3_FOUND)
efc4eb3
   MESSAGE (STATUS "Python libaries not found. Cannot build Python bindings for HokuyoAIST.")
efc4eb3
-endif (NOT PYTHON_LIBRARIES)
efc4eb3
-STRING (REGEX MATCH "^[23]\\.[0-9]" PYTHON_MAJORMINOR_VERSION "${PYTHONLIBS_VERSION_STRING}")
efc4eb3
+endif ()
efc4eb3
 
efc4eb3
 # Find Boost::Python
efc4eb3
 OPTION (Boost_USE_STATIC_LIBS "Use the static versions of the Boost libraries" OFF)
efc4eb3
 MARK_AS_ADVANCED (Boost_USE_STATIC_LIBS)
efc4eb3
 
efc4eb3
-STRING (REGEX REPLACE "[^0-9]" "" BOOST_PY_VERSION ${PYTHON_MAJORMINOR_VERSION})
efc4eb3
-FIND_PACKAGE (Boost COMPONENTS python${TARGET_PYTHON_VERSION})
efc4eb3
+set(BOOST_PY_VERSION "${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
efc4eb3
+FIND_PACKAGE (Boost COMPONENTS python${BOOST_PY_VERSION})
efc4eb3
 if(Boost_FOUND)
efc4eb3
-  if(NOT Boost_PYTHON${TARGET_PYTHON_VERSION}_FOUND)
efc4eb3
+  if(NOT Boost_PYTHON${BOOST_PY_VERSION}_FOUND)
efc4eb3
     MESSAGE (STATUS
efc4eb3
       "Boost::Python library was not found. Cannot build Python bindings for HokuyoAIST.")
efc4eb3
-  endif(NOT Boost_PYTHON${TARGET_PYTHON_VERSION}_FOUND)
efc4eb3
-else(Boost_FOUND)
efc4eb3
+  endif()
efc4eb3
+else()
efc4eb3
   MESSAGE (STATUS
efc4eb3
       "Boost libraries were not found. Cannot build Python bindings for HokuyoAIST.")
efc4eb3
-endif(Boost_FOUND)
efc4eb3
+endif()
efc4eb3
 
efc4eb3
-if(PYTHON_LIBRARIES AND Boost_PYTHON${TARGET_PYTHON_VERSION}_FOUND AND LIB_TYPE STREQUAL SHARED)
efc4eb3
+if(Python3_LIBRARIES AND Boost_PYTHON${BOOST_PY_VERSION}_FOUND AND LIB_TYPE STREQUAL SHARED)
efc4eb3
   MESSAGE (STATUS "HokuyoAIST Python bindings will be built.")
efc4eb3
 
efc4eb3
   SET (pyModuleTarget hokuyoaist_py)
efc4eb3
   INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIRS})
efc4eb3
   INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include/hokuyoaist ${PYTHON_INCLUDE_PATH})
efc4eb3
   add_library(${pyModuleTarget} MODULE hokuyo_aist.cpp)
efc4eb3
-  TARGET_LINK_LIBRARIES (${pyModuleTarget} hokuyoaist Boost::python${TARGET_PYTHON_VERSION} ${PYTHON_LIBRARIES})
efc4eb3
+  TARGET_LINK_LIBRARIES (${pyModuleTarget} hokuyoaist Boost::python${BOOST_PY_VERSION} Python3::Python)
efc4eb3
   SET_TARGET_PROPERTIES (${pyModuleTarget} PROPERTIES PREFIX "" OUTPUT_NAME "hokuyoaist")
efc4eb3
   install(TARGETS ${pyModuleTarget} LIBRARY DESTINATION
efc4eb3
-    ${LIB_INSTALL_DIR}/python${PYTHON_MAJORMINOR_VERSION}/site-packages)
efc4eb3
+    ${LIB_INSTALL_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages)
efc4eb3
 
efc4eb3
   ADD_SUBDIRECTORY (test)
efc4eb3
 ELSEIF(NOT LIB_TYPE STREQUAL SHARED)
efc4eb3
   MESSAGE (STATUS "HokuyoAIST Python bindings will not be built - must build hokuyoaist as a shared library.")
efc4eb3
-endif(PYTHON_LIBRARIES AND Boost_PYTHON-PY${BOOST_PY_VERSION}_FOUND AND LIB_TYPE STREQUAL SHARED)
efc4eb3
+endif()