diff --git a/CMakeLists.txt b/CMakeLists.txt
index 75c6e403838a05cae3104a962e4ae5f2e46e4913..5bda8b129736155d7d54aba6a78a6b941aa8f08b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,9 +117,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
     # See issue 587 and corresponding merge request 415.
     # Clang does not support this flag!
     add_compile_options (-fno-aggressive-loop-optimizations)
+    add_compile_options (-Wno-error=cpp)
 
-    if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "4.7.3")
-        message (FATAL_ERROR "To build OPAL you need GCC version 4.7.3 or greater")
+    if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9.5.0")
+        message (FATAL_ERROR "To build OPAL you need GCC version 9.5.0 or greater")
     endif ()
     # Warning flags
 
@@ -307,9 +308,6 @@ endif ()
 set (OPAL_CXX_FLAGS ${OPAL_CXX_FLAGS}
     CACHE INTERNAL "" FORCE
     )
-set (OPAL_LIBS ${OPAL_LIBS}
-    CACHE INTERNAL "" FORCE
-    )
 
 # configure file
 configure_file (
@@ -321,4 +319,4 @@ install (
     FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config_install.cmake
     DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME}"
     RENAME ${PROJECT_NAME}Config.cmake
-    )
\ No newline at end of file
+    )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2a26fc9e8b63555e406ab3ac2f6fbd272865ea1b..0d1126651c1ca6665563ebd2d1480c58d58d26ed 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -121,15 +121,34 @@ set_property(TARGET libOPALObj PROPERTY POSITION_INDEPENDENT_CODE 1)
 
 add_executable (opal Main.cpp)
 
+set (OPAL_LIBS
+    ${SAAMG_SOLVER_LIBS}
+    ${AMR_MG_SOLVER_LIBS}
+    ${AMR_LIBS}
+    ${MPI_CXX_LIBRARIES}
+    ${OPTP_LIBS}
+    ${OPTP_LIBRARY}
+    ${IPPL_LIBRARY}
+    ${GSL_LIBRARY}
+    ${GSL_CBLAS_LIBRARY}
+    ${H5Hut_LIBRARY}
+    ${HDF5_LIBRARIES}
+    ${Boost_LIBRARIES}
+    m
+    z
+    CACHE STRING "" FORCE
+)
+
 if (WILL_BUILD_STATIC_LIBRARY)
     add_library (libOPALstatic STATIC $<TARGET_OBJECTS:libOPALObj>)
     set_target_properties (libOPALstatic PROPERTIES OUTPUT_NAME OPAL)
-    target_link_libraries (libOPALstatic
-        ${SAAMG_SOLVER_LIBS}
-        ${AMR_MG_SOLVER_LIBS}
-        ${AMR_LIBS}
-        ${MPI_CXX_LIBRARIES}
-        )
+    target_link_libraries (
+        opal
+        libOPALstatic
+        ${OPAL_LIBS}
+        ${CMAKE_DL_LIBS}
+        pthread
+    )
     install (TARGETS libOPALstatic DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
 endif()
 
@@ -137,44 +156,18 @@ if (WILL_BUILD_SHARED_LIBRARY)
     add_library(libOPALdynamic SHARED $<TARGET_OBJECTS:libOPALObj>)
     set_target_properties (libOPALdynamic PROPERTIES OUTPUT_NAME OPAL)
     target_compile_options(libOPALdynamic PRIVATE -fPIC)
-    target_link_libraries( libOPALdynamic
-        ${SAAMG_SOLVER_LIBS}
-        ${AMR_MG_SOLVER_LIBS}
-        ${AMR_LIBS}
-        ${MPI_CXX_LIBRARIES}
-        ${OPTP_LIBS}
-        ${OPTP_LIBRARY}
-        ${IPPL_LIBRARY}
-        ${GSL_LIBRARY}
-        ${GSL_CBLAS_LIBRARY}
-        ${H5Hut_LIBRARY}
-        ${HDF5_LIBRARIES}
-        ${Boost_LIBRARIES}
-        m
-        z
+    target_link_libraries (
+        libOPALdynamic
+        ${OPAL_LIBS}
         "-rdynamic"
-        )
-        install (TARGETS libOPALdynamic DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
+    )
+    install (TARGETS libOPALdynamic DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
 endif()
 
 if (BUILD_OPAL_PYTHON)
     add_subdirectory (PyOpal)
 endif ()
 
-target_link_libraries( opal
-    libOPALstatic
-    ${OPTP_LIBS}
-    ${OPTP_LIBRARY}
-    ${IPPL_LIBRARY}
-    ${GSL_LIBRARY}
-    ${GSL_CBLAS_LIBRARY}
-    ${H5Hut_LIBRARY}
-    ${HDF5_LIBRARIES}
-    ${Boost_LIBRARIES}
-    m
-    z
-    ${CMAKE_DL_LIBS}
-    )
 
 if (ENABLE_OPAL_FEL)
     include_directories (${MITHRA_INCLUDE_DIR})
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e2aa0b3660f07a61496ccb25fb6c7490421c8c91..6ddc68968ca76a81f72e883c170d29bc63a03cb5 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -65,16 +65,7 @@ add_executable (${TEST_EXE} ${TEST_SRCS})
 target_link_libraries (
     ${TEST_EXE}
     libOPALstatic
-    ${OPTP_LIBS}
-    ${OPTP_LIBRARY}
-    ${IPPL_LIBRARY}
-    ${GSL_LIBRARY}
-    ${GSL_CBLAS_LIBRARY}
-    ${H5Hut_LIBRARY}
-    ${HDF5_LIBRARIES}
-    ${Boost_LIBRARIES}
-    ${Trilinos_LIBRARIES} ${Trilinos_TPL_LIBRARIES}
-    ${AMREX_LIBRARIES}
+    ${OPAL_LIBS}
     ${OTHER_CMAKE_EXE_LINKER_FLAGS}
     ${GTEST_BOTH_LIBRARIES}
     pthread
diff --git a/tools/mslang/CMakeLists.txt b/tools/mslang/CMakeLists.txt
index 00989a24111cf0d0311674a89383f2241cc2b78d..305fc5fb1463a53b2e7bed874efea39eed31bb92 100644
--- a/tools/mslang/CMakeLists.txt
+++ b/tools/mslang/CMakeLists.txt
@@ -20,17 +20,8 @@ link_directories (
 
 set (MSLANG_LIBS
     libOPALstatic
-    ${OPTP_LIBS}
-    ${OPTP_LIBRARY}
-    ${IPPL_LIBRARY}
-    ${GSL_LIBRARY}
-    ${GSL_CBLAS_LIBRARY}
-    ${H5Hut_LIBRARY}
-    ${HDF5_LIBRARY}
-    ${Boost_LIBRARIES}
+    ${OPAL_LIBS}
     boost_timer
-    m
-    z
 )
 
 message (STATUS "Compiling MSLang")