diff --git a/.cmake-format.py b/.cmake-format.py
new file mode 100644
index 0000000000000000000000000000000000000000..e1c41b5049c3d189575596f81a21c0f5adb8157b
--- /dev/null
+++ b/.cmake-format.py
@@ -0,0 +1,12 @@
+with section("format"):  # noqa: F821
+    dangle_parens = True
+    max_lines_hwrap = 0
+    keyword_case = "upper"
+    autosort = True
+
+with section("lint"):  # noqa: F821
+    # The formatter sometimes fails to fit the code into the line limit (C0301)
+    # and can disagree with the linter regarding the indentation (C0307):
+    disabled_codes = ["C0301", "C0307"]
+    
+    private_var_pattern = "[A-Z][0-9a-zA-Z]+_[0-9A-Z_]+|_[0-9a-z_]"
diff --git a/.gitignore b/.gitignore
index a96e31806f554d02ddad06f05c5be49f722d5804..8df71dec0484c5605da8e670dfdc9f00aa6606b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,5 +127,17 @@ doc/html/
 #Vim/clangd/treesitter files
 compile_commands.json
 .cache
-#cmake 
-*.cmake
+
+# Cmake 
+CMakeLists.txt.user
+CMakeCache.txt
+CMakeFiles
+CMakeScripts
+Testing
+Makefile
+cmake_install.cmake
+install_manifest.txt
+compile_commands.json
+CTestTestfile.cmake
+_deps
+CMakeUserPresets.json
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..324279b9c2efeb12e7d6c52a538f2c5fbb270505
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,6 @@
+repos:
+  - repo: https://github.com/cheshirekow/cmake-format-precommit
+    rev: v0.6.13
+    hooks:
+      - id: cmake-format
+      - id: cmake-lint
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 73465b1590738fd655233678952fc57c047d679e..eb15a8df060cf59a8094f51759312e4b3fc03e2c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,56 +1,125 @@
 cmake_minimum_required( VERSION 3.30 FATAL_ERROR )
-
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+project( cdo VERSION 2.4.0 LANGUAGES C CXX Fortran)
 
-project( cdo VERSION 2.4.0 LANGUAGES C CXX )
-
-
-
+# --- Additional functionalities for CMake
 include(CTest)
 include(CheckIncludeFileCXX)
 include(CheckIncludeFiles)
+include(CMakePrintHelpers)
+
+add_library(cdolib)
+add_library(operators)
+add_executable(cdo)
 
+# --- Language Standards
 set(CMAKE_C_STANDARD 11)
 set(CMAKE_CXX_STANDARD 20)
 
-
+# --- Evaluate variables in .in and copy do build
 configure_file (
   "${PROJECT_SOURCE_DIR}/cmake/cdo_config.h.in"
   "${PROJECT_BINARY_DIR}/src/config.h"
-  )
+)
+configure_file (
+  "${PROJECT_SOURCE_DIR}/cmake/cdo_config_features.h.in"
+  "${PROJECT_BINARY_DIR}/src/cdo_config_features.h"
+)
+# --- Other compile definitions currently required TEMP
+list(APPEND cdo_compile_definitions
+  restrict=
+  CDI_SIZE_TYPE=size_t #size type for cdi, in cdo its size_t
+  YAC_FOR_CDO
+  HAVE_CONFIG_H=1
+  PACKAGE_NAME="${PACKAGE_NAME}")
 
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
 
-set(pthread_flag HAVE_LIBPTHREAD)
-check_include_files("pthread.h" ${pthread_flag})
-IF(${pthread_flag})
-  add_compile_definitions(${pthread_flag}=1)
-ELSE()
-  message( FATAL_ERROR "pthread.h is not found" )
-ENDIF()
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
 
+# Finding libraries
+### -------------- Pthread ---------------------------
+message("Start check for pthread")
+include(FindThreads)
+find_package(Threads REQUIRED)
+set_target_properties(Threads::Threads PROPERTIES THREADS_PREFER_PTHREAD_FLAG TRUE)
+list(APPEND cdo_compile_definitions HAVE_LIBPTHREAD=1)
 
+### -------------- WordExp ---------------------------
+message("Start check for wordexp")
 set(wordexp_flag HAVE_WORDEXP_H)
 check_include_files("wordexp.h" ${wordexp_flag})
 IF(${wordexp_flag})
-add_compile_definitions(${wordexp_flag}=1)
+  list(APPEND cdo_compile_definitions ${wordexp_flag}=1)
 ELSE()
-  message( STATUS "wordexp.h is not found" )
+  message("wordexp.h is not found" )
 ENDIF()
 
-
+### -------------- proj ---------------------------
+option(ENABLE_PROJ "Enable projection library, use -DPROJ_ROOT for specific path" OFF)
+if(ENABLE_PROJ OR PROJ_ROOT)
+  find_package(PROJ)
+  if(PROJ4::proj)
+    list(APPEND cdo_compile_definitions HAVE_PROJ=${PROJ_FOUND})
+  endif()
+endif()
+
+### -------------- fftw3 ---------------------------
+message("Start check for fftw3")
+find_package(FFTW3 3.0 REQUIRED)
+if(NOT FFTW3_LIBRARIES)
+  message("FFTW3 not found, skipping FFTW3")
+else()
+  if(TARGET FFTW3::fftw3q)
+    set(precision_fftw "q")
+  elseif(TARGET FFTW3::fftw3l)
+    set(precision_fftw "l")
+  elseif(TARGET FFTW3::fftw3f)
+    set(precision_fftw "l")
+  endif()
+  set_target_properties(FFTW3::${FFTW3_LIBRARIES}${precision_fftw} PROPERTIES IMPORTED_LOCATION "${FFTW3_LIBRARIES}"
+    INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIRS}")
+endif()
+
+### -------------- NETCDF ---------------------------
+message("Start check for netCDF4")
 find_package(netCDF 4.0 REQUIRED)
-set(netcdf_flag HAVE_LIBNETCDF)
-if (${netCDF_FOUND})
-  add_compile_definitions(${netcdf_flag}=${netCDF_FOUND})
+
+if (TARGET netCDF::netcdf)
+  message(DEBUG "Checking for netCDF_HAS_NC4 flag equal 'yes' : flag is: ${netCDF_HAS_NC4}")
+  list(APPEND cdo_compile_definitions HAVE_NETCDF=${netCDF_FOUND})
+  list(APPEND cdo_compile_definitions HAVE_LIBNETCDF=${netCDF_FOUND})
+  list(APPEND cdo_compile_definitions HAVE_NETCDF4=${netCDF_FOUND})
 else()
-  message(WARNING "netcdf not found, compiling without netcdf")
+  message(WARNING "Netcdf not found, compiling without netcdf")
 endif ()
-message(STATUS ${pthread_flag} ": "  ${${pthread_flag}})
-message(STATUS ${wordexp_flag} ": "  ${${wordexp_flag}})
-message(STATUS ${netcdf_flag} ": "  ${netCDF_FOUND})
-
+### -------------- CMOR -----------------------------
+message("Start check for CMOR")
+
+if(CMOR_ROOT)
+  message("checking for CMOR requirements")
+  find_package(Uuid REQUIRED)
+  find_package(json-c REQUIRED)
+  find_package(Udunits REQUIRED)
+  message("CMOR requirements found: checking cmor itself")
+  find_package(CMOR)
+  if(TARGET CMOR::CMOR)
+    list(APPEND cdo_compile_definitions "HAVE_LIBCMOR=1")
+    target_link_libraries(operators PUBLIC CMOR::CMOR Uuid::uuid json-c Udunits)
+  endif()
+endif()
+#  ----------------------------------------------------------------------
+
+### -------------- Status ---------------------------
+message("Printing Status")
+message("Internal Flags")
+
+message("Entering Subdirectories")
 add_subdirectory( libcdi)
-add_subdirectory( test )
 add_subdirectory( src )
+add_subdirectory( test )
 
+if(TRUE)
+  cmake_print_properties(TARGETS cdo cdolib operators PROPERTIES  INTERFACE_LINK_LIBRARIES LINK_LIBRARIES)
+  get_property(target_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY IMPORTED_TARGETS)
+  cmake_print_properties(TARGETS ${target_names} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES)
+endif()
diff --git a/cmake/FindCMOR.cmake b/cmake/FindCMOR.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..908344b63fdc0b170c657370a7159f50a558ab6a
--- /dev/null
+++ b/cmake/FindCMOR.cmake
@@ -0,0 +1,30 @@
+find_library(
+  CMOR_LIBRARY
+  NAMES cmor
+  DOC "Climate Model Output Rewriter"
+)
+mark_as_advanced(CMOR_LIBRARY)
+
+
+find_path(CMOR_INCLUDE_DIR
+  NAMES cmor.h 
+  DOC "CMOR3 include directory"
+)
+mark_as_advanced(CMOR_INCLUDE_DIR)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+  CMOR
+  REQUIRED_VARS CMOR_LIBRARY CMOR_INCLUDE_DIR
+)
+if(NOT TARGET CMOR::CMOR)
+  add_library(CMOR::CMOR UNKNOWN IMPORTED )
+
+  target_link_libraries(CMOR::CMOR INTERFACE ${CMOR_LIBRARY} Uuid::uuid Udunits::udunits netCDF::netcdf)
+  target_include_directories(CMOR::CMOR INTERFACE "${CMOR_INCLUDE_DIR};${CMOR_INCLUDE_DIR}/cdTime")
+
+  set_target_properties(CMOR::CMOR PROPERTIES
+    IMPORTED_LOCATION "${CMOR_LIBRARY}"
+    INTERFACE_INCLUDE_DIRECTORIES "${CMOR_INCLUDE_DIR};${CMOR_INCLUDE_DIR}/cdTime")
+
+endif()
diff --git a/cmake/FindUdunits.cmake b/cmake/FindUdunits.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..d66155aab6b566ccf0efaf95726700a3226d6b1a
--- /dev/null
+++ b/cmake/FindUdunits.cmake
@@ -0,0 +1,25 @@
+include(FindPackageHandleStandardArgs)
+
+find_library(Udunits_LIBRARY NAMES udunits2)
+find_path(Udunits_INCLUDE_DIR NAMES udunits2.h)
+find_package_handle_standard_args(Udunits DEFAULT_MSG Udunits_LIBRARY Udunits_INCLUDE_DIR)
+
+if(NOT TARGET Udunits::udunits)
+  add_library(Udunits::udunits UNKNOWN IMPORTED)
+
+
+  target_link_libraries(Udunits::udunits INTERFACE ${Udunits_LIBRARIES})
+  target_include_directories(Udunits::udunits INTERFACE "${Udunits_INCLUDE_DIR}")
+
+  set_target_properties(Udunits::udunits PROPERTIES
+    IMPORTED_LOCATION "${Udunits_LIBRARY}"
+    INTERFACE_INCLUDE_DIRECTORIES "${Udunits_INCLUDE_DIR}")
+
+  mark_as_advanced(
+    Udunits_LIBRARIES
+    Udunits_INCLUDE_DIR
+  )
+  unset(UDUNITS2)
+endif()
+
+
diff --git a/cmake/FindUuid.cmake b/cmake/FindUuid.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..9b045a6acad5aee587ad8796305907774e35e5b2
--- /dev/null
+++ b/cmake/FindUuid.cmake
@@ -0,0 +1,22 @@
+find_library(Uuid_LIBRARY NAMES uuid)
+find_path(Uuid_INCLUDE_DIR NAMES uuid.h)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Uuid DEFAULT_MSG Uuid_LIBRARY Uuid_INCLUDE_DIR)
+
+
+
+if(NOT TARGET Uuid::uuid)
+  add_library(Uuid::uuid UNKNOWN IMPORTED)
+
+  target_link_libraries(Uuid::uuid INTERFACE ${Uuid_LIBRARIES})
+  target_include_directories(Uuid::uuid INTERFACE "${Uuid_INCLUDE_DIRS}")
+
+  set_target_properties(Uuid::uuid PROPERTIES
+    IMPORTED_LOCATION "${Uuid_LIBRARY}"
+    INTERFACE_INCLUDE_DIRECTORIES "${Uuid_INCLUDE_DIR}")
+endif()
+mark_as_advanced(
+Uuid_LIBRARIES
+Uuid_INCLUDE_DIR
+)
+
diff --git a/cmake/cdo_config.h.in b/cmake/cdo_config.h.in
index e88c2884c0989b3f2dc50872d80083084aa3d35d..b0880c9220b7372a35a0256d532c4fa8cec84981 100644
--- a/cmake/cdo_config.h.in
+++ b/cmake/cdo_config.h.in
@@ -1,20 +1,4 @@
-#ifndef cdo_config_h
-#define cdo_config_h
-
-#define PACKAGE_NAME      "@PROJECT_NAME@"
-
-#define VERSION           "@PROJECT_VERSION@"
-
-#define CDI               1
-
-#define HAVE_LIBGRIB      1
-#define HAVE_LIBCGRIBEX   1
-#define HAVE_LIBEXTRA     1
-#define HAVE_LIBSERVICE   1
-#define HAVE_LIBIEG       1
-
-#define HAVE_NETCDF       @HAVE_NETCDF@
-#define HAVE_NETCDF_NC4   @netCDF_HAS_NC4@
-#define NETCDF_FOUND      @NetCDF_FOUND@
+#ifndef CDO_CONFIG_H
+#define CDO_CONFIG_H
 
 #endif /* cdo_config_h */
diff --git a/cmake/cdo_config_features.h.in b/cmake/cdo_config_features.h.in
new file mode 100644
index 0000000000000000000000000000000000000000..6de4ba7073663b6662e7439ea80d66b578a5d5ae
--- /dev/null
+++ b/cmake/cdo_config_features.h.in
@@ -0,0 +1,16 @@
+#ifndef CDO_CONFIG_FEATURES_H
+#define CDO_CONFIG_FEATURES_H
+
+#include <string_view>
+
+/* clang-format off */
+constexpr std::string_view CDO          = "@PROJECT_NAME@";
+constexpr std::string_view CXX_VERSION  = "@CMAKE_CXX_COMPILER_VERSION@"l
+constexpr std::string_view CXX_COMPILER = "@CMAKE_CXX_COMPILER_ID@";
+constexpr std::string_view C_VERSION    = "@CMAKE_C_COMPILER_VERSION@";
+constexpr std::string_view C_COMPILER   = "@CMAKE_C_COMPILER_ID@";
+constexpr std::string_view F77_COMPILER = "@CMAKE_Fortran_COMPILER_ID@";
+constexpr std::string_view F77_VERSION  = "@CMAKE_Fortran_COMPILER_VERSION@";
+/* clang-format on */
+
+#endif
diff --git a/src/CMOR.cc b/src/CMOR.cc
index c36ac8ad39cff0f71a5bb4736f061617ef0900cc..cdb3fc70b8f638695d416afc5a5290952fc2e9d3 100644
--- a/src/CMOR.cc
+++ b/src/CMOR.cc
@@ -23,7 +23,30 @@
 #include "cdo_cdi_wrapper.h"
 #include "varray.h"
 
-#ifdef HAVE_LIBCMOR
+#ifndef HAVE_LIBCMOR //------------------------------------------------------------
+class CMOR : public Process
+{
+public:
+  using Process::Process;
+  inline static CdoModule module = {
+    .name = "CMOR",
+    .operators = { { "cmor", CMORHelp } },
+    .aliases = {},
+    .mode = EXPOSED,     // Module mode: 0:intern 1:extern
+    .number = CDI_REAL,  // Allowed number type
+    .constraints = { 1, 0, NoRestriction },
+  };
+  inline static RegisterEntry<CMOR> registration = RegisterEntry<CMOR>(module);
+
+  /*  clang-format off */
+  void init() override { cdo_abort("CMOR support not compiled in!"); }
+  void run() override { cdo_abort("CMOR support not compiled in!"); }
+  void close() override { cdo_abort("CMOR support not compiled in!"); }
+  /*  clang-format on */
+};
+
+#else //---------------------------------------------------------------------------
+
 #include <cassert>
 #include <unistd.h>
 #include <netcdf.h>
@@ -6319,7 +6342,6 @@ cmor_load_and_set_table(KVList *kvl, std::string const &param0, std::string cons
   return table_id;
 }
 
-#endif
 
 class CMOR : public Process
 {
@@ -6335,7 +6357,6 @@ public:
   };
   inline static RegisterEntry<CMOR> registration = RegisterEntry<CMOR>(module);
 
-#ifdef HAVE_LIBCMOR
   CdoStreamID streamID;
   KVList kvl;
   int vlistID;
@@ -6348,17 +6369,11 @@ public:
   std::string mip_table;
 
   struct mapping *vars;
-#endif
 
 public:
   void
   init() override
   {
-
-#ifndef HAVE_LIBCMOR
-
-    cdo_abort("CMOR support not compiled in!");
-#else
     int nparams = cdo_operator_argc();
 
     if (nparams < 1) cdo_abort("ERROR (infile: '%s')! No parameter found. Need at least a MIP-table.", cdo_get_stream_name(0));
@@ -6399,14 +6414,12 @@ public:
     vlistID = cdo_stream_inq_vlist(streamID);
 
     if (Options::cdoVerbose) cdo_print("3. Successfully opened infile '%s'.", cdo_get_stream_name(0));
-#endif
   }
 
   void
   run() override
   {
 
-#ifdef HAVE_LIBCMOR
     if (Options::cdoVerbose) cdo_print("4. Start to check attributes.");
     /* Short keys from rtu, mt, gi must be included similar to global atts */
     add_globalhybrids(&kvl, vlistID);
@@ -6435,15 +6448,14 @@ public:
     mergeIDs[0] = CMOR_UNDEFID;
     register_all_dimensions(&kvl, streamID, vars, table_id, project_id, miptab_freq, &time_axis, mergeIDs);
     write_variables(&kvl, streamID, vars, miptab_freq, time_axis, calendar, miptab_freqptr, project_id, mergeIDs);
-#endif
   }
 
   void
   close() override
   {
-#ifdef HAVE_LIBCMOR
     destruct_var_mapping(vars);
     /* std::free(miptableInput); */
-#endif
   }
+
 };
+#endif //HAVE_LIBCMOR
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6091124cef7a44b57b512a8d2df937ee53489111..22605eafad0eaa7fa2ad25cfe8c78c663c53faa0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,10 +1,13 @@
-
-set(PACKAGE_NAME "cdo")
+set(PACKAGE_NAME cdo)
 set(VERSION "${CMAKE_PROJECT_VERSION}")
 
 add_subdirectory(lib)
 
+list(APPEND cdo_compile_definitions
+  VERSION="${VERSION}"
+)
 
+# -------- CDO LIB ------------
 list( APPEND cdolib_src_files
   after_fctrans.cc
   after_namelist.cc
@@ -336,7 +339,7 @@ list( APPEND cdolib_src_files
   etopo.dat temp.dat mask.dat
 )
 
-add_library(cdolib
+target_sources(cdolib PRIVATE
   ${cdolib_src_files}
 )
 
@@ -344,26 +347,23 @@ target_include_directories(cdolib
   PRIVATE
   # where the library itself will look for its internal headers
   ${CMAKE_CURRENT_SOURCE_DIR}/src
-  PUBLIC
+  PRIVATE
   # where top-level project will look for the library's public headers
   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
   # where external projects will look for the library's public headers
   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
 )
 
-include_directories("${PROJECT_SOURCE_DIR}/src/mpim_grid"
+target_include_directories(cdolib PRIVATE "${PROJECT_SOURCE_DIR}/src/mpim_grid"
   "${PROJECT_SOURCE_DIR}/src"
   "${PROJECT_BINARY_DIR}/src"
   "${PROJECT_SOURCE_DIR}/libcdi/src"
 )
+target_link_libraries(cdolib Threads::Threads netCDF::netcdf)
+target_compile_definitions(cdolib PRIVATE ${cdo_compile_definitions})
 
-target_link_libraries(cdolib netCDF::netcdf)
-
-target_compile_definitions(cdolib PUBLIC HAVE_CONFIG_H restrict= CDI_SIZE_TYPE=size_t YAC_FOR_CDO)
-
-
-list( APPEND cdo_src_files cdo.cc)
 
+# --------------- CDO OPERATORS --------------------------------
 list( APPEND cdo_operators_src_files
   Afterburner.cc
   Arith.cc
@@ -591,24 +591,24 @@ list( APPEND cdo_operators_src_files
   Splitsel.cc
 )
 
-add_library(operators ${cdo_operators_src_files})
-target_link_libraries(operators PUBLIC  cdolib cdilib yac gradsdes healpix )
+target_sources(operators PRIVATE ${cdo_operators_src_files})
+target_link_libraries(operators PUBLIC cdolib cdilib yac gradsdes healpix)
+target_compile_definitions(operators PRIVATE ${cdo_compile_definitions})
 
-add_executable(cdo
-  ${cdo_src_files}
+target_include_directories(operators PRIVATE
+  "${PROJECT_SOURCE_DIR}/src/mpim_grid"
+  "${PROJECT_SOURCE_DIR}/libcdi/src"
+  "${PROJECT_SOURCE_DIR}/src/"
 )
+# --------------- CDO CLI EXECUTABLE --------------------------------
+list( APPEND cdo_src_files cdo.cc)
 
-target_compile_definitions(cdo PUBLIC
-  restrict=
-  CDI_SIZE_TYPE=size_t
-  YAC_FOR_CDO
-  HAVE_CONFIG_H=1
-  VERSION="${VERSION}"
-  PACKAGE_NAME="${PACKAGE_NAME}"
-)
+target_sources(cdo PRIVATE ${cdo_src_files})
+
+target_compile_definitions(cdo PRIVATE ${cdo_compile_definitions})
+
+target_link_libraries(cdo PRIVATE "$<LINK_LIBRARY:WHOLE_ARCHIVE,operators>")
+target_link_libraries(cdo PRIVATE cdolib cdilib yac gradsdes healpix pthread)
 
 message(STATUS "VERSION : "  ${VERSION})
 message(STATUS "PACKAGE_NAME : "  ${PACKAGE_NAME})
-
-target_link_libraries(cdo PUBLIC "$<LINK_LIBRARY:WHOLE_ARCHIVE,operators>")
-target_link_libraries(cdo PUBLIC cdolib cdilib yac gradsdes healpix pthread )
diff --git a/src/Templates.cc b/src/Templates.cc
index 0db32c185b0e38eeb1e02486929df47bea4984bc..9e8771339d2b78e043c4f7949295f5b42dbf142c 100644
--- a/src/Templates.cc
+++ b/src/Templates.cc
@@ -10,7 +10,7 @@
 #include "process_int.h"
 
 // THIS IS A TEMPLATE FOR LATER USE
-class Template
+class Template : public Process
 {
   CdoStreamID streamID1;
   int taxisID1;
@@ -88,7 +88,7 @@ public:
   }
 };
 
-class Template2
+class Template2 : public Process
 {
   size_t numMissVals;
 
diff --git a/src/cdo_features.cc b/src/cdo_features.cc
index e96e43c4e6e068afe47c79a277919dc34879c1ff..ba918d6a60603146d718cc5050d874239f4c50d1 100644
--- a/src/cdo_features.cc
+++ b/src/cdo_features.cc
@@ -45,13 +45,6 @@
 #include <proj.h>
 #endif
 
-#ifdef HAVE_LIBCMOR
-extern "C"
-{
-#include "cmor.h"
-}
-#endif
-
 #include <cstdio>
 #include <cstring>
 #include <iostream>
@@ -82,12 +75,6 @@ constexpr bool have_hdf5 = true;
 constexpr bool have_hdf5 = false;
 #endif
 
-#ifdef HAVE_LIBCGRIBEX
-constexpr bool have_cgribex = true;
-#else
-constexpr bool have_cgribex = false;
-#endif
-
 #ifdef HAVE_LIBCMOR
 constexpr bool have_cmor = true;
 #else
@@ -144,7 +131,7 @@ static std::map<std::string, std::pair<std::string, bool>> configMap
         { "has-nc5", { "NetCDF 5", cdiHaveFiletype(CDI_FILETYPE_NC5) } },
         { "has-nczarr", { "NetCDF 4 zarr", cdiHaveFiletype(CDI_FILETYPE_NCZARR) } },
         { "has-hdf5", { "HDF5", have_hdf5 } },
-        { "has-cgribex", { "CGRIBEX", have_cgribex } },
+        { "has-cgribex", { "CGRIBEX", cdi_has_cgribex() } },
         { "has-cmor", { "CMOR", have_cmor } },
         { "has-magics", { "MAGICS", have_magics } },
         { "has-openmp", { "OPENMP", have_openmp } },
@@ -211,9 +198,7 @@ print_features()
 #endif
 #endif
 #endif
-#ifdef HAVE_LIBNC_DAP
-  fprintf(fp, " OPeNDAP");
-#endif
+  if(cdi_has_dap()) fprintf(fp," dap");
 #ifdef HAVE_LIBSZ
   fprintf(fp, " sz");
 #endif
@@ -381,14 +366,14 @@ print_config(std::string const &option)
 
   if ("all-json" == option || "all" == option)
     {
-      std::cout << "{";
+      std::cout << "{\n";
       int i = 0;
       for (auto const &entry : configMap)
         {
-          if (i++) fprintf(stdout, ",");
+          if (i++) fprintf(stdout, ",\n");
           std::cout << "\"" << entry.first << "\":\"" << (entry.second.second ? "yes" : "no") << "\"";
         }
-      std::cout << "}\n";
+      std::cout << "\n}\n";
     }
   else
     {
diff --git a/src/cdo_varlist.cc b/src/cdo_varlist.cc
index 17d70a91172ba1787879dab0d6c975f0fe15d1b9..d1790284f37397fdfca2c87154f9738adab7d216 100644
--- a/src/cdo_varlist.cc
+++ b/src/cdo_varlist.cc
@@ -98,6 +98,18 @@ VarList::set_num_const_vars(const CdoVars &cdoVars)
       if (var.timeType == TIME_CONSTANT) m_numConstVars++;
     }
 }
+VarList::VarList(const int _vlistID) : vlistID(_vlistID)
+  {
+    cdoVars_init(vars, _vlistID);
+    m_maxFields = vlistNumFields(_vlistID);
+    m_numSteps = vlistNtsteps(_vlistID);
+    m_numZaxes = vlistNumZaxis(_vlistID);
+    m_numGrids = vlistNumGrids(_vlistID);
+    set_num_const_vars(vars);
+    set_num_varying_vars(vars);
+    m_gridsizeMax = vlistGridsizeMax(_vlistID);
+  }
+
 
 void
 VarList::set_num_varying_vars(const CdoVars &cdoVars)
diff --git a/src/cdo_varlist.h b/src/cdo_varlist.h
index 492818d6d78cf436644df6c9b7ab62cda8893748..75a034503c7b828f35a54ef03fcde243df6c9064 100644
--- a/src/cdo_varlist.h
+++ b/src/cdo_varlist.h
@@ -65,17 +65,7 @@ public:
   int vlistID{ CDI_UNDEFID };
 
   VarList() {}
-  explicit VarList(int _vlistID) : vlistID(_vlistID)
-  {
-    cdoVars_init(vars, _vlistID);
-    m_maxFields = vlistNumFields(_vlistID);
-    m_numSteps = vlistNtsteps(_vlistID);
-    m_numZaxes = vlistNumZaxis(_vlistID);
-    m_numGrids = vlistNumGrids(_vlistID);
-    set_num_const_vars(vars);
-    set_num_varying_vars(vars);
-    m_gridsizeMax = cdo_vlist_gridsizemax(_vlistID);
-  }
+  explicit VarList(const int _vlistID);
 
   // clang-format off
   void isInit() const { assert(vlistID != CDI_UNDEFID); }
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 16dd503814c444247fd84d5928dacffd0d138910..2d3ddf07aca884e617fa88b2fd77a0707fd2557b 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -1,3 +1,3 @@
 add_subdirectory(gradsdes)
 add_subdirectory(healpix)
-add_subdirectory(yac/src)
+add_subdirectory(yac)
diff --git a/src/lib/yac/CMakeLists.txt b/src/lib/yac/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9f9e89a8f0d44807e8aeca24a760fb742cf3de4a
--- /dev/null
+++ b/src/lib/yac/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_subdirectory(clapack)
+add_subdirectory(src)
+target_link_libraries(yac libyac_clapack)
diff --git a/src/lib/yac/clapack/CMakeLists.txt b/src/lib/yac/clapack/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..4f6cf4e8afb91fbe7de29fd9dc7187eba7eee731
--- /dev/null
+++ b/src/lib/yac/clapack/CMakeLists.txt
@@ -0,0 +1,104 @@
+configure_file (
+  "${CMAKE_CURRENT_SOURCE_DIR}/F2CLIBS/libf2c/sysdep1.h0"
+  "${CMAKE_CURRENT_BINARY_DIR}/sysdep1.h"
+)
+
+#AM_CFLAGS = $(PIC_CFLAGS)
+
+list(APPEND libyac_clapack_src_files
+  BLAS/SRC/dcopy.c
+  BLAS/SRC/ddot.c
+  BLAS/SRC/dgemm.c
+  BLAS/SRC/dgemv.c
+  BLAS/SRC/dger.c
+  BLAS/SRC/dnrm2.c
+  BLAS/SRC/dscal.c
+  BLAS/SRC/dswap.c
+  BLAS/SRC/dsymv.c
+  BLAS/SRC/dsyr.c
+  BLAS/SRC/dtrmm.c
+  BLAS/SRC/dtrmv.c
+  BLAS/SRC/dtrsm.c
+  BLAS/SRC/idamax.c
+  F2CLIBS/libf2c/close.c
+  F2CLIBS/libf2c/d_lg10.c
+  F2CLIBS/libf2c/d_sign.c
+  F2CLIBS/libf2c/endfile.c
+  F2CLIBS/libf2c/err.c
+  F2CLIBS/libf2c/exit_.c
+  F2CLIBS/libf2c/f77_aloc.c
+  F2CLIBS/libf2c/fio.h
+  F2CLIBS/libf2c/fmt.c
+  F2CLIBS/libf2c/fmt.h
+  F2CLIBS/libf2c/fmtlib.c
+  F2CLIBS/libf2c/fp.h
+  F2CLIBS/libf2c/i_nint.c
+  F2CLIBS/libf2c/open.c
+  F2CLIBS/libf2c/pow_di.c
+  F2CLIBS/libf2c/s_cat.c
+  F2CLIBS/libf2c/s_cmp.c
+  F2CLIBS/libf2c/s_copy.c
+  F2CLIBS/libf2c/sfe.c
+  F2CLIBS/libf2c/sig_die.c
+  F2CLIBS/libf2c/util.c
+  F2CLIBS/libf2c/wref.c
+  F2CLIBS/libf2c/wrtfmt.c
+  F2CLIBS/libf2c/wsfe.c
+  INCLUDE/blaswrap.h
+  INCLUDE/clapack.h
+  INCLUDE/f2c.h
+  INSTALL/dlamch.c
+  INSTALL/lsame.c
+  SRC/dgelq2.c
+  SRC/dgelqf.c
+  SRC/dgels.c
+  SRC/dgeqr2.c
+  SRC/dgeqrf.c
+  SRC/dgesv.c
+  SRC/dgetf2.c
+  SRC/dgetrf.c
+  SRC/dgetri.c
+  SRC/dgetrs.c
+  SRC/disnan.c
+  SRC/dlabad.c
+  SRC/dlaisnan.c
+  SRC/dlange.c
+  SRC/dlapy2.c
+  SRC/dlarfb.c
+  SRC/dlarf.c
+  SRC/dlarfp.c
+  SRC/dlarft.c
+  SRC/dlascl.c
+  SRC/dlaset.c
+  SRC/dlassq.c
+  SRC/dlaswp.c
+  SRC/dlasyf.c
+  SRC/dorm2r.c
+  SRC/dorml2.c
+  SRC/dormlq.c
+  SRC/dormqr.c
+  SRC/dsytf2.c
+  SRC/dsytrf.c
+  SRC/dsytri.c
+  SRC/dtrti2.c
+  SRC/dtrtri.c
+  SRC/dtrtrs.c
+  SRC/ieeeck.c
+  SRC/iladlc.c
+  SRC/iladlr.c
+  SRC/ilaenv.c
+  SRC/iparmq.c
+  SRC/xerbla.c)
+
+add_library(libyac_clapack ${libyac_clapack_src_files})
+target_include_directories(libyac_clapack PRIVATE
+  PRIVATE
+  # where the library itself will look for its internal headers
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/src
+  ${CMAKE_CURRENT_SOURCE_DIR}/INCLUDE
+
+  # where top-level project will look for the library's public headers
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/INCLUDE>
+
+)
diff --git a/src/lib/yac/src/CMakeLists.txt b/src/lib/yac/src/CMakeLists.txt
index 21ca118b6c6bced2780514e9eab54fe31548f13d..e48df7a530398f17ce176ddf551a87885bf38094 100644
--- a/src/lib/yac/src/CMakeLists.txt
+++ b/src/lib/yac/src/CMakeLists.txt
@@ -21,9 +21,9 @@ list( APPEND yac_src_files
                location.h
                sphere_part.c
                sphere_part.h
+               utils_common.h
                utils_core.c
                utils_core.h
-               utils_common.h
                yac_lapack_interface.c
                yac_lapack_interface.h
                yac_types.h
diff --git a/src/process.cc b/src/process.cc
index 03d8742b92cb9ab5bdb9b2c7a3fca1b351ca51f0..4637023017a829c44321242307ccf621f4e9523d 100644
--- a/src/process.cc
+++ b/src/process.cc
@@ -14,7 +14,7 @@
 #include <pthread.h>
 #endif
 
-#ifdef HAVE_LIBNETCDF
+#ifdef HAVE_NETCDF
 #include <netcdf.h>
 #include <netcdf_mem.h>
 #endif
@@ -306,7 +306,7 @@ Process::create_output()
 {
   int ncid = -1;
 
-#ifdef HAVE_LIBNETCDF
+#ifdef HAVE_NETCDF
   if (auto retVal = nc_create_mem("test_name", 0, 4096, &ncid))
     {
       printf("Error: %s\n", nc_strerror(retVal));
@@ -316,10 +316,14 @@ Process::create_output()
 
   int streamID = streamOpenWriteNCMem(ncid);
 #else
-  int streamID = -1;
+  int streamID = -100103;
 #endif
 
-  if (streamID < 0) { throw std::runtime_error("ERROR: could not open stream from memory"); }
+
+      std::stringstream ss = std::stringstream();
+      ss << "ERROR: could not open output stream to memory: errcode: ";
+      ss << std::to_string(streamID);
+  if (streamID < 0) { throw std::runtime_error(ss.str());}
   return { ncid, streamID };
 }
 
diff --git a/test/bandit_tests/CMakeLists.txt b/test/bandit_tests/CMakeLists.txt
index 1c68a3eb9ebe940f5f7180870fef113110bb3dd8..a240e7867140f4495c05b3250a49d689fbc874b6 100644
--- a/test/bandit_tests/CMakeLists.txt
+++ b/test/bandit_tests/CMakeLists.txt
@@ -24,6 +24,7 @@ foreach(target ${current_targets})
   target_include_directories(${target} PRIVATE ../../libcdi/interfaces/)
   target_include_directories(${target} PRIVATE ../../libcdi/src/)
   target_link_libraries(${target} PRIVATE cdolib cdilib)
+  target_compile_definitions(${target} PRIVATE ${cdo_compile_definitons})
   add_test(NAME ${target} COMMAND ${target})
   if(labels_${target})
     set_property(TEST ${target} PROPERTY LABELS labels_${target})
diff --git a/test/bandit_tests/util_string.cc b/test/bandit_tests/util_string.cc
index bbec2808440cbd1d21e04268cb5b41ab21171bc8..dda9a99908d0e31b6b55a37dcd94afd1e4e75cdd 100644
--- a/test/bandit_tests/util_string.cc
+++ b/test/bandit_tests/util_string.cc
@@ -134,9 +134,6 @@ test_string_to_integral_failures()
 }
 
 go_bandit([]() {
-  //==============================================================================
-  //
-  //
   bandit::describe("Testing trim functions", []() {
     bandit::describe("Testing ltrim function", []() {
       std::string to_be_trimmed = "  spaces in front  ";