diff --git a/doc/contributions.txt b/doc/contributions.txt
index 9267d7ab088ea9dc8a7e64842b90e605d53abf25..612041ecc521117c499d15e5f4113893d94d878a 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -523,6 +523,7 @@ Robin Cornelius
 	SNOW-506
 	SNOW-514
 	SNOW-520
+	SNOW-507
 	SNOW-585
 	VWR-2488
 	VWR-9557
diff --git a/indra/llcharacter/CMakeLists.txt b/indra/llcharacter/CMakeLists.txt
index 85e3f970927180627d568b4585a1d8f3f05fba3c..14841b5d3ddeb0af7068eb972e15242fd294abfd 100644
--- a/indra/llcharacter/CMakeLists.txt
+++ b/indra/llcharacter/CMakeLists.txt
@@ -77,11 +77,12 @@ list(APPEND llcharacter_SOURCE_FILES ${llcharacter_HEADER_FILES})
 add_library (llcharacter ${llcharacter_SOURCE_FILES})
 
 
-# Add tests
-include(LLAddBuildTest)
-# UNIT TESTS
-SET(llcharacter_TEST_SOURCE_FILES
-  lljoint.cpp
-  )
-LL_ADD_PROJECT_UNIT_TESTS(llcharacter "${llcharacter_TEST_SOURCE_FILES}")
-
+if(LL_TESTS)
+  # Add tests
+  include(LLAddBuildTest)
+  # UNIT TESTS
+  SET(llcharacter_TEST_SOURCE_FILES
+      lljoint.cpp
+      )
+  LL_ADD_PROJECT_UNIT_TESTS(llcharacter "${llcharacter_TEST_SOURCE_FILES}")
+endif(LL_TESTS)
diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt
index a563db901a84eeaf95e19da77ff032899a3c8e71..6b2b61f88353727c667be8711474ac1bc29c9491 100644
--- a/indra/llinventory/CMakeLists.txt
+++ b/indra/llinventory/CMakeLists.txt
@@ -59,16 +59,16 @@ list(APPEND llinventory_SOURCE_FILES ${llinventory_HEADER_FILES})
 add_library (llinventory ${llinventory_SOURCE_FILES})
 
 
+if(LL_TESTS)
+  #add unit tests
+  INCLUDE(LLAddBuildTest)
+  SET(llinventory_TEST_SOURCE_FILES
+      # no real unit tests yet!
+      )
+  LL_ADD_PROJECT_UNIT_TESTS(llinventory "${llinventory_TEST_SOURCE_FILES}")
 
-#add unit tests
-INCLUDE(LLAddBuildTest)
-SET(llinventory_TEST_SOURCE_FILES
-  # no real unit tests yet!
-  )
-LL_ADD_PROJECT_UNIT_TESTS(llinventory "${llinventory_TEST_SOURCE_FILES}")
-
-#set(TEST_DEBUG on)
-set(test_libs llinventory ${LLMESSAGE_LIBRARIES} ${LLVFS_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
-LL_ADD_INTEGRATION_TEST(inventorymisc "" "${test_libs}")
-LL_ADD_INTEGRATION_TEST(llparcel "" "${test_libs}")
-
+  #set(TEST_DEBUG on)
+  set(test_libs llinventory ${LLMESSAGE_LIBRARIES} ${LLVFS_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
+  LL_ADD_INTEGRATION_TEST(inventorymisc "" "${test_libs}")
+  LL_ADD_INTEGRATION_TEST(llparcel "" "${test_libs}")
+endif(LL_TESTS)
diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt
index 68a3d54597fcbd529516f7e6f2534f1ff5244f33..f4d21308b3fdfe7915993b19872253abeccf0a05 100644
--- a/indra/llprimitive/CMakeLists.txt
+++ b/indra/llprimitive/CMakeLists.txt
@@ -53,9 +53,11 @@ list(APPEND llprimitive_SOURCE_FILES ${llprimitive_HEADER_FILES})
 
 add_library (llprimitive ${llprimitive_SOURCE_FILES})
 
-#add unit tests
-INCLUDE(LLAddBuildTest)
-SET(llprimitive_TEST_SOURCE_FILES
-  llmediaentry.cpp
-  )
-LL_ADD_PROJECT_UNIT_TESTS(llprimitive "${llprimitive_TEST_SOURCE_FILES}")
+if(LL_TESTS)
+  #add unit tests
+  INCLUDE(LLAddBuildTest)
+  SET(llprimitive_TEST_SOURCE_FILES
+      llmediaentry.cpp
+      )
+  LL_ADD_PROJECT_UNIT_TESTS(llprimitive "${llprimitive_TEST_SOURCE_FILES}")
+endif(LL_TESTS)
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index 12df9ccae45139a460d83f1cba3038f5fe944b79..8e78a5fefd0eed719b999813689f4da29d6bbf3a 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -240,10 +240,12 @@ target_link_libraries(llui
     ${LLCOMMON_LIBRARIES} # must be after llimage, llwindow, llrender
     )
 
-# Add tests
-include(LLAddBuildTest)
-SET(llui_TEST_SOURCE_FILES
-    llurlmatch.cpp
-    llurlentry.cpp
-    )
-LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}")
+if(LL_TESTS)
+  # Add tests
+  include(LLAddBuildTest)
+  SET(llui_TEST_SOURCE_FILES
+      llurlmatch.cpp
+      llurlentry.cpp
+      )
+  LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}")
+endif(LL_TESTS)
diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt
index 05c7c7860c7f655cce60097ee14c8ffee50d8b6f..722f4e2bfdef9c6212c9edf06f2abee5f55ff996 100644
--- a/indra/llvfs/CMakeLists.txt
+++ b/indra/llvfs/CMakeLists.txt
@@ -67,15 +67,17 @@ if (DARWIN)
 endif (DARWIN)
 
 
-# Add tests
-include(LLAddBuildTest)
-# UNIT TESTS
-SET(llvfs_TEST_SOURCE_FILES
-  # none so far
-  )
-LL_ADD_PROJECT_UNIT_TESTS(llvfs "${llvfs_TEST_SOURCE_FILES}")
-
-# INTEGRATION TESTS
-set(test_libs llmath llcommon llvfs ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
-# TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests.
-LL_ADD_INTEGRATION_TEST(lldir "" "${test_libs}")
+if(LL_TESTS)
+  # Add tests
+  include(LLAddBuildTest)
+  # UNIT TESTS
+  SET(llvfs_TEST_SOURCE_FILES
+      # none so far
+      )
+  LL_ADD_PROJECT_UNIT_TESTS(llvfs "${llvfs_TEST_SOURCE_FILES}")
+
+  # INTEGRATION TESTS
+  set(test_libs llmath llcommon llvfs ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
+  # TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests.
+  LL_ADD_INTEGRATION_TEST(lldir "" "${test_libs}")
+endif(LL_TESTS)
diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt
index fbcfade383abf01917dc520853cb27ac48de5025..eb5166ee71f057d0d03e65e283a37fcdb3e3c849 100644
--- a/indra/llxml/CMakeLists.txt
+++ b/indra/llxml/CMakeLists.txt
@@ -45,24 +45,27 @@ target_link_libraries( llxml
     ${EXPAT_LIBRARIES}
     )
 
-# tests
 
-# unit tests
+if(LL_TESTS)
+  # tests
 
-SET(llxml_TEST_SOURCE_FILES
-  # none yet!
-  )
-LL_ADD_PROJECT_UNIT_TESTS(llxml "${llxml_TEST_SOURCE_FILES}")
+  # unit tests
 
-# integration tests
+  SET(llxml_TEST_SOURCE_FILES
+      # none yet!
+      )
+  LL_ADD_PROJECT_UNIT_TESTS(llxml "${llxml_TEST_SOURCE_FILES}")
 
-#    set(TEST_DEBUG on)
-set(test_libs
-  ${LLXML_LIBRARIES}
-  ${WINDOWS_LIBRARIES}
-  ${LLMATH_LIBRARIES}
-  ${LLCOMMON_LIBRARIES}
-  )
+  # integration tests
 
-LL_ADD_INTEGRATION_TEST(llcontrol "" "${test_libs}")
+  # set(TEST_DEBUG on)
+  set(test_libs
+      ${LLXML_LIBRARIES}
+      ${WINDOWS_LIBRARIES}
+      ${LLMATH_LIBRARIES}
+      ${LLCOMMON_LIBRARIES}
+      )
 
+  LL_ADD_INTEGRATION_TEST(llcontrol "" "${test_libs}")
+
+endif(LL_TESTS)