--- CMakeLists.txt.orig	2020-10-09 16:43:28 UTC
+++ CMakeLists.txt
@@ -28,12 +28,21 @@ if(BUILD_PYTHON)
     # However currently on our CI server it finds the wrong Python version and then doesn't find the headers.
     find_package(PythonInterp 3.4 REQUIRED)
     find_package(PythonLibs 3.4 REQUIRED)
-
-    find_package(SIP REQUIRED)
+if(NOT PYTHON_EXECUTABLE STREQUAL "")
+   set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
+   message("Using given PYTHON_EXECUTABLE")
+endif()
+if(NOT PYTHON_INCLUDE_DIR STREQUAL "")
+    set(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR})
+   message("Using given PYTHON_INCLUDE_DIR")
+endif()
+find_package(SIP REQUIRED)
     if(NOT DEFINED LIB_SUFFIX)
         set(LIB_SUFFIX "")
     endif()
-
+if(NOT PYTHON_INCLUDEDIR STREQUAL "")
+    message("Setting Python3_INCLUDE_DIRS = ${PYTHON_INCLUDEDIR}")
+endif()
     include_directories(python/ src/ ${SIP_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS})
 endif()
 
@@ -88,7 +97,7 @@ endif()
 if(BUILD_PYTHON)
     set(SIP_EXTRA_FILES_DEPEND python/SocketListener.sip python/Types.sip python/PythonMessage.sip python/Error.sip)
     set(SIP_EXTRA_SOURCE_FILES python/PythonMessage.cpp)
-    set(SIP_EXTRA_OPTIONS -g) # -g means always release the GIL before calling C++ methods.
+    set(SIP_EXTRA_OPTIONS -g -n PyQt5.sip) # -g means always release the GIL before calling C++ methods.
     add_sip_python_module(Arcus python/Socket.sip Arcus)
 endif()
 
