diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11e936f3db37dc84317d9ce8b3448f7ca51561c7..be903c4c3f5a391ecdc45ebb4dfaf1b79c9f9a9b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,30 +2,55 @@
 # refer to the root source directory of the project as ${CBMROOT_SOURCE_DIR} or
 # as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as
 # ${CBMROOT_BINARY_DIR} or ${CMAKE_BINARY_DIR}.
-# This difference is important for the base classes which are in CBMROOT
-# and PANDAROOT.
 
 # Check if cmake has the required version
-# For the CTest fixtures at least CMake 3.7.2 is needed.
 # Since flesnet requires 3.14.0 we should be consistent while we
 # build it in the CbmRoot context
-cmake_minimum_required(VERSION 3.14)
-
-# Set name of our project to "CBMROOT". Has to be done
-# after check of cmake version
-project(CBMROOT)
+cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
+cmake_policy(VERSION 3.14...3.23)
+
+# Define compiler on macosx to avoid problems when comparing to compilers
+# used for FairSoft/FairRoot compilation
+if(APPLE)
+  if(NOT DEFINED CMAKE_C_COMPILER)
+    set(CMAKE_C_COMPILER clang)
+  endif()
+  if(NOT DEFINED CMAKE_CXX_COMPILER)
+    set(CMAKE_CXX_COMPILER clang++)
+  endif()
+endif()
 
+# Default CMake settings
 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+# Set the library version in the main CMakeLists.txt
+set(CBMROOT_MAJOR_VERSION 22)
+set(CBMROOT_MINOR_VERSION 2)
+set(CBMROOT_PATCH_VERSION 99)
+
+# Set name of our project to "CBMROOT"
+# This also sets ${CBMROOT_VERSION} to the provided VERSION value, which would be empty if not set here explicitly
+project(CBMROOT 
+        VERSION ${CBMROOT_MAJOR_VERSION}.${CBMROOT_MINOR_VERSION}.${CBMROOT_PATCH_VERSION}
+        LANGUAGES C CXX
+)
+
+# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
+# is checked
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
+
+# Load some basic cmake functionality
+include(ExternalProject)
+include(CTest)
 
 # Make the CbmRoot cmake functions available
 list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
 include(CbmChecks)
 include(CbmGenerateConfig)
-
-# Load some basic macros which are needed later on
 include(CbmMacros)
 include(CbmTargets)
-include(CbmGenerateConfig)
 include(CbmCompilerSettings)
 
 # Do some basic checks 
@@ -33,58 +58,72 @@ include(CbmCompilerSettings)
 # existence of FAIRROOTPATH and SIMPATH variables 
 Check_Prerequisites()
 
-# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
-# is checked
-list(APPEND CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old")
-list(APPEND CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules")
+# Load cmake functionality from the FairRoot installation
+if(IS_DIRECTORY ${FAIRROOTPATH}/share/fairbase/cmake/modules)
+  list(APPEND CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules")
+endif()
+if(IS_DIRECTORY ${FAIRROOTPATH}/share/fairbase/cmake/modules_old)
+  list(APPEND CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old")
+endif()
+include(FairMacros)
+include(WriteConfigFile)
+include(CheckCompiler)
 
-set(CMAKE_PREFIX_PATH ${SIMPATH} ${CMAKE_PREFIX_PATH})
-set(CMAKE_INSTALL_LIBDIR lib)
 
+# Has to be called after the CMAKE_MODULE_PATH contains the FairRoot
+# directories since the file is part of FairRoot 
 set(FairRoot_DIR ${FAIRROOTPATH})
-find_package(FairRoot)
+find_package(FairRoot REQUIRED)
+
+
 
-include(FairMacros)
-include(WriteConfigFile)
-include(CTest)
-include(CheckCompiler)
-Include(ExternalProject)
 
 # Check if the compiler supports the needed C++ standard
 # Check for the minimum required versions of FairSoft and FairRoot
 check_external_stack()
- 
+
 # Set the compiler flags
 set_compiler_flags()
 
+# Allow to find <package>Config.cmake files in the FairSoft installation 
+set(CMAKE_PREFIX_PATH ${SIMPATH} ${CMAKE_PREFIX_PATH})
+
+# Define where the produced targets are placed in the binary directory
 Set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
 Set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
 Set(INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
+set(CMAKE_INSTALL_LIBDIR lib)
 
+# VMCWORKDIR is needed by the CbmRoot runtime to find macros, geometries and
+# parameters
 Set(VMCWORKDIR ${CBMROOT_SOURCE_DIR})
 
+# Set library versioning
+set(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES}
+    VERSION "${CBMROOT_VERSION}"
+    SOVERSION "${CBMROOT_MAJOR_VERSION}"
+)
+
 # searches for needed packages
 # REQUIRED means that cmake will stop if this packages are not found
 # For example the framework can run without GEANT4, but ROOT is
 # mandatory
-find_package(ROOT 6.00.00 REQUIRED)
-if("${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}" VERSION_GREATER 6.16)
-  if("${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}" VERSION_LESS 6.26)
-    Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --has-vmc
-                    OUTPUT_VARIABLE ROOT_vmc_FOUND
-                   )
-
-    String(STRIP ${ROOT_vmc_FOUND} ROOT_vmc_FOUND)
-    If(NOT ROOT_vmc_FOUND)
-      set(CMAKE_PREFIX_PATH ${SIMPATH} ${CMAKE_PREFIX_PATH})
-      find_package2(PUBLIC VMC REQUIRED)
-      set(VMCLIB VMCLibrary)
-    endif()
-  else()
+find_package(ROOT 6.22.08 REQUIRED)
+if("${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}" VERSION_LESS 6.26)
+  Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --has-vmc
+                  OUTPUT_VARIABLE ROOT_vmc_FOUND
+                 )
+
+  String(STRIP ${ROOT_vmc_FOUND} ROOT_vmc_FOUND)
+  If(NOT ROOT_vmc_FOUND)
     set(CMAKE_PREFIX_PATH ${SIMPATH} ${CMAKE_PREFIX_PATH})
     find_package2(PUBLIC VMC REQUIRED)
     set(VMCLIB VMCLibrary)
   endif()
+else()
+  set(CMAKE_PREFIX_PATH ${SIMPATH} ${CMAKE_PREFIX_PATH})
+  find_package2(PUBLIC VMC REQUIRED)
+  set(VMCLIB VMCLibrary)
 endif()
 
 find_package2(PUBLIC Geant3 REQUIRED)
@@ -102,7 +141,6 @@ find_package(GEANT4DATA)
 find_package(GEANT4VMC)
 find_package(TBB)
 find_package(SSE)
-#  find_package(IWYU)
 find_package(ZeroMQ)
 
 Set(Boost_NO_SYSTEM_PATHS TRUE)
@@ -138,30 +176,12 @@ SetBasicVariables()
 SET(ROOT_INCLUDE_PATH ${ROOT_INCLUDE_PATH} "${Geant3_INCLUDE_DIRS}")
 
 Set(BASE_INCLUDE_DIRECTORIES
-${BASE_INCLUDE_DIRECTORIES}
-${SYSTEM_INCLUDE_DIRECTORIES}
-${FAIRLOGGER_INCLUDE_DIR}
-${VMC_INCLUDE_DIRS}
+  ${BASE_INCLUDE_DIRECTORIES}
+  ${SYSTEM_INCLUDE_DIRECTORIES}
+  ${FAIRLOGGER_INCLUDE_DIR}
+  ${VMC_INCLUDE_DIRS}
 )
 
-# Set the library version in the main CMakeLists.txt
-SET(CBMROOT_MAJOR_VERSION 0)
-SET(CBMROOT_MINOR_VERSION 0)
-SET(CBMROOT_PATCH_VERSION 0)
-SET(CBMROOT_VERSION "${CBMROOT_MAJOR_VERSION}.${CBMROOT_MINOR_VERSION}.${CBMROOT_PATCH_VERSION}")
-If(NOT ROOT_FOUND_VERSION OR ROOT_FOUND_VERSION LESS 59999)
-  SET(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES}
-      VERSION "${CBMROOT_VERSION}"
-      SOVERSION "${CBMROOT_MAJOR_VERSION}"
-      SUFFIX ".so"
-  )
-Else()
-  SET(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES}
-      VERSION "${CBMROOT_VERSION}"
-      SOVERSION "${CBMROOT_MAJOR_VERSION}"
-  )
-EndIf()
-
 SET(CBMLIBDIR ${CMAKE_BINARY_DIR}/lib)
 SET(LD_LIBRARY_PATH  ${CBMLIBDIR} ${Boost_LIBRARY_DIRS} ${LD_LIBRARY_PATH})
 
@@ -186,7 +206,9 @@ endif()
 
 ### Subdirectories to be compiled #####
 
-### Externals included and build from sveral sources
+### Externals included and build from several sources
+# Must be the first subdirectory since the defined targets are needed by
+# following targets
 add_subdirectory (external)
 
 ### Base directories
@@ -208,17 +230,18 @@ endif()
 
 add_subdirectory (macro)
 add_subdirectory(fles)
+
 If(FAIRMQ_FOUND)
   add_subdirectory(MQ)
 EndIf()
 
 add_subdirectory(tutorials)
 
-Option(BUILD_DOXYGEN "Build Doxygen" OFF)
+option(BUILD_DOXYGEN "Build Doxygen" OFF)
 if(BUILD_DOXYGEN)
-  MESSAGE(STATUS "*** Building the Doxygen documentaion ***")
-  ADD_SUBDIRECTORY(doxygen)
-endif(BUILD_DOXYGEN)
+  message(STATUS "*** Building the Doxygen documentaion ***")
+  add_subdirectory(doxygen)
+endif()
 
 # Definde additional targets 
 # cleanlib: rm al Cbm libraries and dictionaries