diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ccfc430544e2b391f438f7ecf10860ae127da14..d7ff607bba1840442e1b2fc82687bd781cb96346 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,11 @@ INCLUDE(${Simox_SOURCE_DIR}/CMakeModules/SimoxMacros.cmake)
 #global config
 # Set up build type
 
+if(${CMAKE_VERSION} VERSION_GREATER 3.16)
+    set(CMAKE_UNITY_BUILD ON)
+    set(CMAKE_UNITY_BUILD_BATCH_SIZE 0)
+endif()
+
 IF(NOT CMAKE_BUILD_TYPE)
     SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
 endif()
diff --git a/SimDynamics/DynamicsEngine/BulletEngine/BulletOpenGL/CMakeLists.txt b/SimDynamics/DynamicsEngine/BulletEngine/BulletOpenGL/CMakeLists.txt
index 26ff3c90b6b70e6a1f9f40000e8f7e5f14e29b00..399aa7dab485082d05c5c1bd70374a3491ae3fe7 100644
--- a/SimDynamics/DynamicsEngine/BulletEngine/BulletOpenGL/CMakeLists.txt
+++ b/SimDynamics/DynamicsEngine/BulletEngine/BulletOpenGL/CMakeLists.txt
@@ -1,5 +1,7 @@
 # This is copied from the bullet sources since the openGL support library is usually not included in any linux packages.
 
+set(CMAKE_UNITY_BUILD OFF)
+
 PROJECT(BulletOpenGLSupport)
 
 if (SimDynamics_USE_BULLET AND OPENGL_FOUND)