diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake
index 3557a99248a1301407fa89965a0ff1f9cce48fc3..cabea78d3f0477156ef68ec8615eddd161beba2c 100644
--- a/indra/cmake/LLAddBuildTest.cmake
+++ b/indra/cmake/LLAddBuildTest.cmake
@@ -3,42 +3,46 @@ INCLUDE(APR)
 INCLUDE(LLMath)
 
 MACRO(ADD_BUILD_TEST_NO_COMMON name parent)
-    SET(no_common_libraries
-        ${APRUTIL_LIBRARIES}
-        ${APR_LIBRARIES}
-        ${PTHREAD_LIBRARY}
-        ${WINDOWS_LIBRARIES}
-        )    
-    SET(no_common_libraries
-        ${APRUTIL_LIBRARIES}
-        ${APR_LIBRARIES}
-        ${PTHREAD_LIBRARY}
-        ${WINDOWS_LIBRARIES}
-        )
-    SET(no_common_source_files
-        ${name}.cpp
-        tests/${name}_test.cpp
-        ${CMAKE_SOURCE_DIR}/test/test.cpp
-        )
-    ADD_BUILD_TEST_INTERNAL(${name} ${parent} "${no_common_libraries}" "${no_common_source_files}")
+    IF (EXISTS tests/${name}_test.cpp)
+        SET(no_common_libraries
+            ${APRUTIL_LIBRARIES}
+            ${APR_LIBRARIES}
+            ${PTHREAD_LIBRARY}
+            ${WINDOWS_LIBRARIES}
+            )    
+        SET(no_common_libraries
+            ${APRUTIL_LIBRARIES}
+            ${APR_LIBRARIES}
+            ${PTHREAD_LIBRARY}
+            ${WINDOWS_LIBRARIES}
+            )
+        SET(no_common_source_files
+            ${name}.cpp
+            tests/${name}_test.cpp
+            ${CMAKE_SOURCE_DIR}/test/test.cpp
+            )
+        ADD_BUILD_TEST_INTERNAL(${name} ${parent} "${no_common_libraries}" "${no_common_source_files}")
+    ENDIF (EXISTS tests/${name}_test.cpp)
 ENDMACRO(ADD_BUILD_TEST_NO_COMMON name parent)
 
 
 MACRO(ADD_BUILD_TEST name parent)
-    SET(basic_libraries
-        ${LLCOMMON_LIBRARIES}
-        ${APRUTIL_LIBRARIES}
-        ${APR_LIBRARIES}
-        ${PTHREAD_LIBRARY}
-        ${WINDOWS_LIBRARIES}
-        )
-    SET(basic_source_files
-        ${name}.cpp
-        tests/${name}_test.cpp
-        ${CMAKE_SOURCE_DIR}/test/test.cpp
-        ${CMAKE_SOURCE_DIR}/test/lltut.cpp
-        )
-    ADD_BUILD_TEST_INTERNAL(${name} ${parent} "${basic_libraries}" "${basic_source_files}")
+    IF (EXISTS tests/${name}_test.cpp)
+        SET(basic_libraries
+            ${LLCOMMON_LIBRARIES}
+            ${APRUTIL_LIBRARIES}
+            ${APR_LIBRARIES}
+            ${PTHREAD_LIBRARY}
+            ${WINDOWS_LIBRARIES}
+            )
+        SET(basic_source_files
+            ${name}.cpp
+            tests/${name}_test.cpp
+            ${CMAKE_SOURCE_DIR}/test/test.cpp
+            ${CMAKE_SOURCE_DIR}/test/lltut.cpp
+            )
+        ADD_BUILD_TEST_INTERNAL(${name} ${parent} "${basic_libraries}" "${basic_source_files}")
+    ENDIF (EXISTS tests/${name}_test.cpp)
 ENDMACRO(ADD_BUILD_TEST name parent)