diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b3dfd4b04eb658154fbbf4dab03714889cc6dd6..07ccb92883966bf91cb342e31604ff254e520c4e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,10 @@ if(NOT DEPENDENCIES_LINK_TYPE AND NOT ENV{DEPENDENCIES_LINK_TYPE})
     message(FATAL_ERROR "Please, set the variable DEPENDENCIES_LINK_TYPE to either 'static' or 'shared'!")
 endif()
 
+if(ENV{DEPENDENCIES_LINK_TYPE})
+    set(DEPENDENCIES_LINK_TYPE ENV{DEPENDENCIES_LINK_TYPE})
+endif()
+
 #--------------------------------#
 # Setting C++ compiler flags #
 #--------------------------------#
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b3a69cfdf4b7bd030957c725422f3fb1859f1283..364be4eea5b461c9d756aac3aa89f8e6c36b122f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,10 +7,16 @@ if ("${BUILD_EXAMPLES}" STREQUAL "yes")
 endif ()
 
 if ("${BUILD_LIB}" STREQUAL "yes")
+
+	set(LIB_TYPE "STATIC")
+	if(DEPENDENCIES_LINK_TYPE STREQUAL "shared")
+		set(LIB_TYPE "SHARED")
+	endif()
+
     add_library(
         exprtk_wrap
 
-        SHARED
+        ${LIB_TYPE}
 
         General/ExprtkWrapper.cpp
         Exception/Exceptions.cpp
@@ -31,7 +37,11 @@ if ("${BUILD_LIB}" STREQUAL "yes")
 			${Boost_LIBRARIES}
 	)
 
-	add_library(lib4neuro SHARED
+	add_library(
+        lib4neuro
+
+        ${LIB_TYPE}
+
 		Neuron/Neuron.cpp
 		Neuron/NeuronBinary.cpp
 		Neuron/NeuronConstant.cpp