--- a/aux/broker/bindings/python/CMakeLists.txt	2016-03-17 23:26:42.707456012 +0100
+++ b/aux/broker/bindings/python/CMakeLists.txt	2016-03-17 23:28:27.714453166 +0100
@@ -52,19 +52,21 @@
 swig_add_module(pybroker python pybroker.i)
 swig_link_libraries(pybroker ${libbroker} ${PYTHON_LIBRARIES})
 
-if ( BROKER_PYTHON_PREFIX )
-    set(pyver ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-    set(PY_MOD_INSTALL_DIR
-        ${BROKER_PYTHON_PREFIX}/lib/python${pyver}/site-packages)
-elseif ( BROKER_PYTHON_HOME )
-    set(PY_MOD_INSTALL_DIR ${BROKER_PYTHON_HOME}/lib/python)
-else ()
-    execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
-        "from distutils.sysconfig import get_python_lib; print get_python_lib()"
-                    OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
-                    OUTPUT_STRIP_TRAILING_WHITESPACE)
-    set(PY_MOD_INSTALL_DIR ${PYTHON_SITE_PACKAGES})
-endif ()
+if ( NOT PY_MOD_INSTALL_DIR )
+    if ( BROKER_PYTHON_PREFIX )
+        set(pyver ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+        set(PY_MOD_INSTALL_DIR
+            ${BROKER_PYTHON_PREFIX}/lib/python${pyver}/site-packages)
+    elseif ( BROKER_PYTHON_HOME )
+        set(PY_MOD_INSTALL_DIR ${BROKER_PYTHON_HOME}/lib/python)
+    else ()
+        execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
+            "from distutils.sysconfig import get_python_lib; print get_python_lib()"
+                        OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
+                        OUTPUT_STRIP_TRAILING_WHITESPACE)
+        set(PY_MOD_INSTALL_DIR ${PYTHON_SITE_PACKAGES})
+    endif ( BROKER_PYTHON_PREFIX )
+endif ( NOT PY_MOD_INSTALL_DIR )
 
 message(STATUS "Python bindings will be built and installed to: "
                ${PY_MOD_INSTALL_DIR})
