diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8dfb771d6..d4290eb37 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -379,21 +379,21 @@ set(memgraph_src_files
 )
 # -----------------------------------------------------------------------------
 
-# STATIC library used by memgraph executables
-add_library(memgraph_lib STATIC ${memgraph_src_files})
-target_link_libraries(memgraph_lib stdc++fs gflags)
-add_dependencies(memgraph_lib generate_opencypher_parser
-                              generate_plan_compiler_flags)
-# executables that require memgraph_lib should link MEMGRAPH_ALL_LIBS to link all dependant libraries
-set(MEMGRAPH_ALL_LIBS memgraph_lib stdc++fs Threads::Threads fmt yaml-cpp antlr_opencypher_parser_lib dl)
+# memgraph_lib and memgraph_pic depend on these libraries
+set(MEMGRAPH_ALL_LIBS gflags stdc++fs Threads::Threads fmt yaml-cpp antlr_opencypher_parser_lib dl)
 if (READLINE_FOUND)
     list(APPEND MEMGRAPH_ALL_LIBS ${READLINE_LIBRARY})
 endif()
-# -----------------------------------------------------------------------------
+
+# STATIC library used by memgraph executables
+add_library(memgraph_lib STATIC ${memgraph_src_files})
+target_link_libraries(memgraph_lib ${MEMGRAPH_ALL_LIBS})
+add_dependencies(memgraph_lib generate_opencypher_parser
+                              generate_plan_compiler_flags)
 
 # STATIC PIC library used by query engine
-add_library(memgraph_pic STATIC)
-target_link_libraries(memgraph_pic stdc++fs gflags)
+add_library(memgraph_pic STATIC ${memgraph_src_files})
+target_link_libraries(memgraph_pic ${MEMGRAPH_ALL_LIBS})
 add_dependencies(memgraph_pic generate_opencypher_parser
                               generate_plan_compiler_flags)
 set_property(TARGET memgraph_pic PROPERTY POSITION_INDEPENDENT_CODE TRUE)
@@ -442,7 +442,7 @@ if (MEMGRAPH)
     add_executable(${MEMGRAPH_BUILD_NAME} ${src_dir}/memgraph_bolt.cpp)
     set_property(TARGET ${MEMGRAPH_BUILD_NAME}
                  PROPERTY CXX_STANDARD ${cxx_standard})
-    target_link_libraries(${MEMGRAPH_BUILD_NAME} ${MEMGRAPH_ALL_LIBS})
+    target_link_libraries(${MEMGRAPH_BUILD_NAME} memgraph_lib)
 endif()
 
 # utility target to copy hardcoded queries
@@ -450,7 +450,7 @@ endif()
 add_executable(__copy_hardcoded_queries ${src_dir}/copy_hardcoded_queries.cpp)
 set_property(TARGET __copy_hardcoded_queries PROPERTY CXX_STANDARD
         ${cxx_standard})
-target_link_libraries(__copy_hardcoded_queries ${MEMGRAPH_ALL_LIBS})
+target_link_libraries(__copy_hardcoded_queries memgraph_lib)
 add_custom_target(copy_hardcoded_queries ./__copy_hardcoded_queries --src
         ${CMAKE_SOURCE_DIR}/tests/integration/hardcoded_query --dst
         ${CMAKE_BINARY_DIR}/compiled/hardcode
@@ -478,7 +478,7 @@ if(HARDCODED_TARGETS)
       set(target_name __${file_name}_hardcoded_target)
       add_executable(${target_name} ${CMAKE_SOURCE_DIR}/libs/__main.cpp
                                     ${file_path})
-      target_link_libraries(${target_name} ${MEMGRAPH_ALL_LIBS})
+      target_link_libraries(${target_name} memgraph_lib)
       set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
       set_target_properties(${target_name}
                             PROPERTIES RUNTIME_OUTPUT_DIRECTORY
diff --git a/libs/setup.sh b/libs/setup.sh
index d923af188..9b5b939b4 100755
--- a/libs/setup.sh
+++ b/libs/setup.sh
@@ -19,9 +19,12 @@ cd ..
 
 # fmt
 git clone https://github.com/fmtlib/fmt.git
-fmt_tag="e5e4fb370ccf327bbdcdcd782eb3e53580e11094" # v3.0.0
+fmt_tag="7fa8f8fa48b0903deab5bb42e6760477173ac485" # v3.0.1
+# Commit which fixes an issue when compiling with C++14 and higher.
+fmt_cxx14_fix="b9aaa507fc49680d037fd84c043f747a395bce04"
 cd fmt
 git checkout ${fmt_tag}
+git cherry-pick ${fmt_cxx14_fix}
 cd ..
 
 # google benchmark
diff --git a/poc/CMakeLists.txt b/poc/CMakeLists.txt
index 075e5a370..92392f97b 100644
--- a/poc/CMakeLists.txt
+++ b/poc/CMakeLists.txt
@@ -25,6 +25,6 @@ foreach(poc_cpp ${poc_cpps})
     set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
 
     # link libraries
-    target_link_libraries(${target_name} ${MEMGRAPH_ALL_LIBS})
+    target_link_libraries(${target_name} memgraph_lib)
 
 endforeach()
diff --git a/tests/benchmark/CMakeLists.txt b/tests/benchmark/CMakeLists.txt
index 4b079ecd9..c1fbdcf6b 100644
--- a/tests/benchmark/CMakeLists.txt
+++ b/tests/benchmark/CMakeLists.txt
@@ -26,7 +26,7 @@ foreach(test_cpp ${test_type_cpps})
     set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
 
     # link libraries
-    target_link_libraries(${target_name} ${MEMGRAPH_ALL_LIBS})
+    target_link_libraries(${target_name} memgraph_lib)
     # google-benchmark
     target_link_libraries(${target_name} benchmark ${CMAKE_THREAD_LIBS_INIT})
 
diff --git a/tests/concurrent/CMakeLists.txt b/tests/concurrent/CMakeLists.txt
index 2118a9761..85d48be1e 100644
--- a/tests/concurrent/CMakeLists.txt
+++ b/tests/concurrent/CMakeLists.txt
@@ -26,7 +26,7 @@ foreach(test_cpp ${test_type_cpps})
     set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
 
     # link libraries
-    target_link_libraries(${target_name} ${MEMGRAPH_ALL_LIBS})
+    target_link_libraries(${target_name} memgraph_lib)
     # gtest
     target_link_libraries(${target_name} gtest gtest_main)
 
diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt
index 2667c080c..b85aaf18c 100644
--- a/tests/integration/CMakeLists.txt
+++ b/tests/integration/CMakeLists.txt
@@ -24,7 +24,7 @@ foreach(test_cpp ${test_type_cpps})
     set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
 
     # link libraries
-    target_link_libraries(${target_name} ${MEMGRAPH_ALL_LIBS})
+    target_link_libraries(${target_name} memgraph_lib)
 
     # register test
     add_test(${target_name} ${exec_name})
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt
index 9e10b9ad9..c0e160478 100644
--- a/tests/manual/CMakeLists.txt
+++ b/tests/manual/CMakeLists.txt
@@ -31,6 +31,6 @@ foreach(test_cpp ${test_type_cpps})
     set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
 
     # link libraries
-    target_link_libraries(${target_name} ${MEMGRAPH_ALL_LIBS})
+    target_link_libraries(${target_name} memgraph_lib)
 
 endforeach()
diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt
index 65eced1d3..9b9af268b 100644
--- a/tests/unit/CMakeLists.txt
+++ b/tests/unit/CMakeLists.txt
@@ -28,7 +28,7 @@ foreach(test_cpp ${test_type_cpps})
     set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
 
     # link libraries
-    target_link_libraries(${target_name} ${MEMGRAPH_ALL_LIBS})
+    target_link_libraries(${target_name} memgraph_lib)
     # gtest
     target_link_libraries(${target_name} gtest gtest_main gmock)
     if(${TEST_COVERAGE})