diff --git a/CMake/FindCasacore.cmake b/CMake/FindCasacore.cmake
index 51d8339..299530f 100644
--- a/CMake/FindCasacore.cmake
+++ b/CMake/FindCasacore.cmake
@@ -17,6 +17,8 @@
 #
 # Variables used by this module:
 #  CASACORE_ROOT_DIR         - Casacore root directory. 
+#  BLAS_LIBS                 - override BLAS library
+#  LAPACK_LIBS               - override LAPACK library
 #
 # Variables defined by this module:
 #  CASACORE_FOUND            - System has Casacore, which means that the
@@ -232,7 +234,21 @@ else(NOT CASACORE_INCLUDE_DIR)
     elseif(${_comp} STREQUAL fits)
       casacore_find_package(CFITSIO REQUIRED)
     elseif(${_comp} STREQUAL scimath_f)
-      casacore_find_package(LAPACK REQUIRED)
+      # If only looking for LAPACK, no library will be added if LAPACK
+      # is part of BLAS, as it is customary nowadays. So look for both
+      # to avoid confusing linker errors on symbols used in headers/templates.
+      if(DEFINED ENV{BLAS_LIBS})
+        set(BLAS_FOUND YES)
+        list(APPEND CASACORE_LIBRARIES $ENV{BLAS_LIBS})
+      else()
+        casacore_find_package(BLAS   REQUIRED)
+      endif()
+      if(DEFINED ENV{LAPACK_LIBS})
+        set(LAPACK_FOUND YES)
+        list(APPEND CASACORE_LIBRARIES $ENV{LAPACK_LIBS})
+      else()
+        casacore_find_package(LAPACK REQUIRED)
+      endif()
     endif(${_comp} STREQUAL casa)
   endforeach(_comp ${_find_components})
 endif(NOT CASACORE_INCLUDE_DIR)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2867d9c..7d41a23 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.0)
+cmake_minimum_required(VERSION 3.5.0)
 
 project(lofarbeam)
 
@@ -65,37 +65,40 @@ elseif(DOXYGEN_FOUND)
 
 endif(DOXYGEN_FOUND)
 
+# ThOr: This is NOT the modern cmake-included FindPython!
 find_package (Python COMPONENTS Development)
+
 message("Compiling Python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} support. If this is not the intended target use 'DPYTHON_EXECUTABLE' to control.")
 # bind against boost-python for compilation of the python API
 # depending on major release version of the python libraries
-if (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
-  find_package (Boost REQUIRED COMPONENTS python numpy)
-  find_package (Casacore REQUIRED COMPONENTS python)
-  message(STATUS "Boost python library: ${Boost_PYTHON_LIBRARY}")
-  message(STATUS "Boost numpy library: ${Boost_NUMPY_LIBRARY}")
-  message(STATUS "Python library ${PYTHON_LIBRARIES}")
-  set(BOOST_PY_FOUND TRUE)
-else (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
-  find_package (Boost REQUIRED COMPONENTS python3 numpy3)
-  find_package (Casacore REQUIRED COMPONENTS python3)
-  message(STATUS "Boost python library: ${Boost_PYTHON3_LIBRARY}")
-  message(STATUS "Boost numpy library: ${Boost_NUMPY3_LIBRARY}")
-  message(STATUS "Python library ${PYTHON_LIBRARIES}")
-  set(BOOST_PY_FOUND TRUE)
-endif (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
-
-
-if(BOOST_PY_FOUND)
-    add_library(_stationresponse MODULE pystationresponse.cc)
-    set_target_properties(_stationresponse PROPERTIES PREFIX "")
-    target_include_directories(_stationresponse PRIVATE ${PYTHON_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
-    if (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
-      target_link_libraries(_stationresponse stationresponse ${CASA_PYTHON_LIBRARY} ${Boost_PYTHON_LIBRARY} ${Boost_NUMPY_LIBRARY} ${PYTHON_LIBRARIES})
-    else (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
-      target_link_libraries(_stationresponse stationresponse ${CASA_PYTHON3_LIBRARY} ${Boost_PYTHON3_LIBRARY} ${Boost_NUMPY3_LIBRARY} ${PYTHON_LIBRARIES})
-    endif (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
-    install(TARGETS _stationresponse DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
-    install(FILES __init__.py DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
-endif(BOOST_PY_FOUND)
-
+if(${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+  set(casapy "")
+  set(oldboostpy "")
+else()
+  set(casapy "3")
+  set(oldboostpy "3")
+endif()
+set(boostpy ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
+message("trying boostpy=${boostpy}")
+find_package(Boost 1.67.0 COMPONENTS python${boostpy} numpy${boostpy})
+if(NOT Boost_FOUND)
+  message(STATUS "Falling back to old Boost search.")
+  set(boostpy ${oldboostpy})
+  find_package(Boost REQUIRED COMPONENTS python${boostpy} numpy${boostpy})
+endif()
+find_package (Casacore REQUIRED COMPONENTS python${casapy})
+if(${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+  set(casapylib ${CASA_PYTHON_LIBRARY})
+else()
+endif()
+
+message(STATUS "Boost python library: ${Boost_PYTHON_LIBRARY}")
+message(STATUS "Boost numpy library: ${Boost_NUMPY_LIBRARY}")
+message(STATUS "Python library ${Python_LIBRARIES}")
+
+add_library(_stationresponse MODULE pystationresponse.cc)
+set_target_properties(_stationresponse PROPERTIES PREFIX "")
+target_include_directories(_stationresponse PRIVATE ${PYTHON_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
+target_link_libraries(_stationresponse stationresponse ${casapylib} Boost::python${boostpy} Boost::numpy${boostpy} ${PYTHON_LIBRARIES})
+install(TARGETS _stationresponse DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
+install(FILES __init__.py DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
