diff --git a/CMakeLists.txt b/CMakeLists.txt
index a9d03362733b8a4bc746f90e4f8af0d134a7bec8..6b88ac5443968ec8bf7b89b24ab8667d0e4fa1b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,13 +65,18 @@ foreach(var ${variables})
 endforeach()
 
 #---Move (copy) the headers and other directories to binary tree---------------------------------
-add_custom_target(move_headers  COMMAND ${CMAKE_COMMAND} -DPREFIX=${CMAKE_BINARY_DIR} -DCOMPONENTS="headers"
-                                        -P ${CMAKE_SOURCE_DIR}/cmake/scripts/local_install.cmake
-                                COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/etc ${CMAKE_BINARY_DIR}/etc
-                                COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/icons ${CMAKE_BINARY_DIR}/icons
-                                COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/fonts ${CMAKE_BINARY_DIR}/fonts
-                                COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/macros ${CMAKE_BINARY_DIR}/macros
-                                COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tutorials ${CMAKE_BINARY_DIR}/tutorials)
+set(stamp_file ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/move_headers.stamp)
+add_custom_command(OUTPUT ${stamp_file}
+                   COMMAND ${CMAKE_COMMAND} -DPREFIX=${CMAKE_BINARY_DIR} -DCOMPONENTS="headers"
+                                            -P ${CMAKE_SOURCE_DIR}/cmake/scripts/local_install.cmake
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/etc ${CMAKE_BINARY_DIR}/etc
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/icons ${CMAKE_BINARY_DIR}/icons
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/fonts ${CMAKE_BINARY_DIR}/fonts
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/macros ${CMAKE_BINARY_DIR}/macros
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tutorials ${CMAKE_BINARY_DIR}/tutorials
+                   COMMAND ${CMAKE_COMMAND} -E touch ${stamp_file}
+                   COMMENT "Moving headers and other directorties such as etc, icons, fonts,...")
+add_custom_target(move_headers DEPENDS ${stamp_file})
 
 #---Recurse into the given subdirectories.  This does not actually cause another cmake executable
 #  to run. The same process will walk through the project's entire directory structure.
diff --git a/core/utils/CMakeLists.txt b/core/utils/CMakeLists.txt
index 250d59b41618a7f8cc95f1f16335e86f36a79a26..0b0e5cb860ee610b40cd73febbf95d3bf4c80d34 100644
--- a/core/utils/CMakeLists.txt
+++ b/core/utils/CMakeLists.txt
@@ -71,8 +71,9 @@ set_source_files_properties(src/LinkdefReader.cxx PROPERTIES COMPILE_FLAGS -fno-
 set_source_files_properties(src/rootclingTCling.cxx PROPERTIES COMPILE_FLAGS -I${CMAKE_SOURCE_DIR}/core/meta/src)
 
 #---Deal with LLVM resource here----------------------------------------------
-set(files_to_copy COMMAND cmake -E copy ${CMAKE_BINARY_DIR}/interpreter/llvm/src/include/llvm/Config/llvm-config.h
+set(copy_commands COMMAND cmake -E copy ${CMAKE_BINARY_DIR}/interpreter/llvm/src/include/llvm/Config/llvm-config.h
                                         ${CMAKE_BINARY_DIR}/etc/cling/llvm/Config/llvm-config.h)
+set(files_to_copy ${CMAKE_BINARY_DIR}/interpreter/llvm/src/include/llvm/Config/llvm-config.h)
 
 install(DIRECTORY ${CMAKE_BINARY_DIR}/etc/cling/llvm/Config DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cling/llvm)
 install(DIRECTORY ${CMAKE_BINARY_DIR}/interpreter/llvm/src/lib/clang/${LLVM_VERSION}/include/
@@ -93,13 +94,15 @@ foreach(file  Interpreter/DynamicExprInfo.h
               Interpreter/RuntimeUniverse.h
               Interpreter/Value.h)
   get_filename_component(path ${file} PATH)
-  list(APPEND files_to_copy COMMAND cmake -E copy ${clinginclude}/cling/${file} ${CMAKE_BINARY_DIR}/etc/cling/${file})
+  list(APPEND copy_commands COMMAND cmake -E copy ${clinginclude}/cling/${file} ${CMAKE_BINARY_DIR}/etc/cling/${file})
+  list(APPEND files_to_copy ${clinginclude}/cling/${file})
   set_property(GLOBAL APPEND PROPERTY CLINGETCPCH etc/cling/${file})
   install(FILES ${clinginclude}/cling/${file} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cling/${path})
 endforeach()
 
 foreach(file  multimap  multiset)
-  list(APPEND files_to_copy COMMAND cmake -E copy ${CMAKE_SOURCE_DIR}/interpreter/cling/include/cling/cint/${file} ${CMAKE_BINARY_DIR}/etc/cling/cint/${file})
+  list(APPEND copy_commands COMMAND cmake -E copy ${CMAKE_SOURCE_DIR}/interpreter/cling/include/cling/cint/${file} ${CMAKE_BINARY_DIR}/etc/cling/cint/${file})
+  list(APPEND files_to_copy ${CMAKE_SOURCE_DIR}/interpreter/cling/include/cling/cint/${file})
   install(FILES ${CMAKE_SOURCE_DIR}/interpreter/cling/include/cling/cint/${file} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cling/cint)
 endforeach()
 
@@ -120,22 +123,28 @@ foreach( file llvm/ADT/IntrusiveRefCntPtr.h
               llvm/Support/type_traits.h )
   get_filename_component(path ${file} PATH)
   if(EXISTS ${llvminclude}/${file})
-    list(APPEND files_to_copy COMMAND cmake -E copy ${llvminclude}/${file} ${CMAKE_BINARY_DIR}/etc/cling/${file})
+    list(APPEND copy_commands COMMAND cmake -E copy ${llvminclude}/${file} ${CMAKE_BINARY_DIR}/etc/cling/${file})
+    list(APPEND files_to_copy ${llvminclude}/${file})
     install(FILES ${llvminclude}/${file} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cling/${path})
   else()
-    list(APPEND files_to_copy COMMAND cmake -E copy ${llvminclude-bin}/${file} ${CMAKE_BINARY_DIR}/etc/cling/${file})
+    list(APPEND copy_commands COMMAND cmake -E copy ${llvminclude-bin}/${file} ${CMAKE_BINARY_DIR}/etc/cling/${file})
+    list(APPEND files_to_copy ${llvminclude-bin}/${file})
     install(FILES ${llvminclude-bin}/${file} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cling/${path})
   endif()
   set_property(GLOBAL APPEND PROPERTY CLINGETCPCH etc/cling/${file})
 endforeach()
 
-add_custom_target(LLVMRES COMMAND cmake -E make_directory
-                                  ${CMAKE_BINARY_DIR}/etc/cling/lib/clang/${LLVM_VERSION}/include
-                          COMMAND cmake -E copy_directory
+set(stamp_file ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/LLVMRES.stamp)
+add_custom_command(OUTPUT ${stamp_file}
+                   COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/etc/cling/lib/clang/${LLVM_VERSION}/include
+                   COMMAND cmake -E copy_directory
                                   ${CMAKE_BINARY_DIR}/interpreter/llvm/src/lib/clang/${LLVM_VERSION}/include
                                   ${CMAKE_BINARY_DIR}/etc/cling/lib/clang/${LLVM_VERSION}/include
-                          ${files_to_copy}
-                          DEPENDS CLING)
+                   ${copy_commands}
+                   COMMAND cmake -E touch ${stamp_file}
+                   DEPENDS ${files_to_copy}
+                   COMMENT "Copying LLVM respurce and header files")
+add_custom_target(LLVMRES DEPENDS ${stamp_file} CLING)
 
 
 #---Trick to avoid building all dictionaties when CINT is changed-------------
diff --git a/math/mathcore/test/CMakeLists.txt b/math/mathcore/test/CMakeLists.txt
index e9aa01b9a6750ec91b676c8a15cdeb4cbb890f5c..092e3cc9172b26ae5fc5c40c076548d7bfc6531f 100644
--- a/math/mathcore/test/CMakeLists.txt
+++ b/math/mathcore/test/CMakeLists.txt
@@ -12,7 +12,6 @@ set(TestSource
     testSortOrder.cxx
     stressTMath.cxx
     stressTF1.cxx
-    stressGoFTest.cxx
     testIntegration.cxx
     testRootFinder.cxx
     testSampleQuantiles.cxx
@@ -37,12 +36,15 @@ set(TestSource
 if(ROOT_roofit_FOUND)
   list(APPEND TestSource fit/testRooFit.cxx)
   list(APPEND Libraries RooFit)
+  if(ROOT_mathmore_FOUND)
+    list(APPEND TestSource fit/testFitPerf.cxx)
+  endif()
+endif()
+
 if(ROOT_mathmore_FOUND)
-  list(APPEND TestSource fit/testFitPerf.cxx)
+  list(APPEND TestSource stressGoFTest.cxx)
   list(APPEND Libraries MathMore)
 endif()
-endif()
-
 
 if(ROOT_minuit2_FOUND)
   list(APPEND TestSource fit/testMinim.cxx)