diff --git a/CMake/VirtualFluidsMacros.cmake b/CMake/VirtualFluidsMacros.cmake
index cf0f24ec944883538749775ecbcdd4a43a370b3b..24a40b7a38a0ebbe1fac7c169e60ecd147803f1e 100644
--- a/CMake/VirtualFluidsMacros.cmake
+++ b/CMake/VirtualFluidsMacros.cmake
@@ -100,6 +100,9 @@ endfunction()
 ##
 #################################################################################
 function(vf_add_library)
+    # enable clang tidy for this target
+    find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
+    set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
 
     set( options )
     set( oneValueArgs )
@@ -169,6 +172,7 @@ function(vf_add_library)
 
     status("... configuring target: ${library_name} (type=${ARG_BUILDTYPE}) done")
 
+    unset(CMAKE_CXX_CLANG_TIDY)
 endfunction()
 
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69e078ffe4cf0a6033eca7eb305e0b00d7770e42..6c98c8aa639a81526606a7124bf97e1c150a6032 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,9 +57,6 @@ endif()
 include(CMakePrintHelpers)
 include(${VF_CMAKE_DIR}/VirtualFluidsMacros.cmake)
 
-find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
-set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
-
 #################################################################################
 #  COMMON LIBRARIES
 #################################################################################