diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3cf4f903de888037356b8f41161dd3b2d2ec968c..c765b2d3675884fc164b87d04d7484a4b95abf06 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -443,6 +443,9 @@ if(USE_CXX)
     set(CPP_2_HYSOP "cpp2hysop")
 endif()
 
+# Append pythonlib to hysop link floags
+list(APPEND HYSOP_LINK_LIBRARIES ${PYTHON_LIBRARIES} )
+
 # ====== Generates python files required for build/install process ======
 # The file setup.py will be generated from setup.py.in.
 if(EXISTS ${CMAKE_SOURCE_DIR}/setup.py.in)
diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh
old mode 100644
new mode 100755
index 65adde1d2218949375cdf9a8e0c7d1637932f2fb..eceb2693f3c27710cf7b81130078dbcba1091bd0
--- a/ci/scripts/test.sh
+++ b/ci/scripts/test.sh
@@ -2,19 +2,19 @@
 set -e
 
 if [ $# -ne 3 ]; then
-    echo "Usage ./test install_folder hysop_folder"
+    echo "Usage ./test install_folder hysop_folder cache_dir"
     exit 1
 fi
 
 if [ ! -d "$1" ]; then
     echo "Folder $1 does not exist."
     exit 1
-fi 
+fi
 
 if [ ! -d "$2" ]; then
     echo "Folder $2 does not exist."
     exit 1
-fi 
+fi
 
 INSTALL_DIR=$1
 HYSOP_DIR=$2
@@ -27,7 +27,7 @@ if [ -d "$CACHE_DIR" ]; then
 else
     echo "Cache directory '$CACHE_DIR' was not found."
     mkdir -p $CACHE_DIR
-fi 
+fi
 
 export PYTHONPATH="$INSTALL_DIR/lib/python2.7/site-packages"
 python -c 'import hysop; print hysop'