diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake
index fa95e08dcdddeaf5cddab64b457ebdfbe0fbb0c5..408280f0cc01868be452de7baecf0a69569d35eb 100644
--- a/indra/cmake/LLAddBuildTest.cmake
+++ b/indra/cmake/LLAddBuildTest.cmake
@@ -19,89 +19,88 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
   #
   # More info and examples at: https://wiki.secondlife.com/wiki/How_to_add_unit_tests_to_indra_code
   #
-  # WARNING: do NOT modify this code without working with poppy -
+  # WARNING: do NOT modify this code without working with poppy - (2022-09-17: ND, I did not talk to poppy, are we all doomed now?)
   # there is another branch that will conflict heavily with any changes here.
-INCLUDE(GoogleMock)
 
-  IF(LL_TEST_VERBOSE)
-    MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}")
-  ENDIF(LL_TEST_VERBOSE)
+  # This here looks weird, but is needed. It will inject GoogleMock into projects that forgot to include `this` (LLAddBuildTest.cmake)
+  # But through some other means have access to this macro
+  include(GoogleMock)
+
+  if(LL_TEST_VERBOSE)
+    message("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}")
+  endif()
 
   # Start with the header and project-wide setup before making targets
   #project(UNITTEST_PROJECT_${project})
   # Setup includes, paths, etc
-  SET(alltest_SOURCE_FILES
-    ${CMAKE_SOURCE_DIR}/test/test.cpp
-    ${CMAKE_SOURCE_DIR}/test/lltut.cpp
-    )
-  SET(alltest_DEP_TARGETS
-    # needed by the test harness itself
-    llcommon
-    )
-
-  SET(alltest_INCLUDE_DIRS
-          ${LIBS_OPEN_DIR}/test
+  set(alltest_SOURCE_FILES
+          ${CMAKE_SOURCE_DIR}/test/test.cpp
+          ${CMAKE_SOURCE_DIR}/test/lltut.cpp
           )
-  SET(alltest_LIBRARIES
+  set(alltest_DEP_TARGETS
+          # needed by the test harness itself
+          llcommon
+          )
+
+  set(alltest_LIBRARIES
           llcommon
           ll::googlemock
           )
-  IF(NOT "${project}" STREQUAL "llmath")
+  if(NOT "${project}" STREQUAL "llmath")
     # add llmath as a dep unless the tested module *is* llmath!
-    LIST(APPEND alltest_DEP_TARGETS
-            llmath
-            )
-    LIST(APPEND alltest_LIBRARIES
-            llmath
-            )
-  ENDIF(NOT "${project}" STREQUAL "llmath")
+    list(APPEND alltest_DEP_TARGETS llmath)
+    list(APPEND alltest_LIBRARIES llmath )
+  endif()
 
   # Headers, for convenience in targets.
-  SET(alltest_HEADER_FILES
-    ${CMAKE_SOURCE_DIR}/test/test.h
-    )
+  set(alltest_HEADER_FILES ${CMAKE_SOURCE_DIR}/test/test.h)
 
   # start the source test executable definitions
-  SET(${project}_TEST_OUTPUT "")
-  FOREACH (source ${sources})
-    STRING( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} )
-    STRING( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} )
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})")
-    ENDIF(LL_TEST_VERBOSE)
+  set(${project}_TEST_OUTPUT "")
+  foreach (source ${sources})
+    string( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} )
+    string( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} )
+    if(LL_TEST_VERBOSE)
+      message("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})")
+    endif()
 
     #
     # Per-codefile additional / external source, header, and include dir property extraction
     #
     # Source
     GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_SOURCE_FILES ${source} LL_TEST_ADDITIONAL_SOURCE_FILES)
-    SET(${name}_test_SOURCE_FILES
-      ${source}
-      tests/${name}_test.${extension}
-      ${alltest_SOURCE_FILES}
-      ${${name}_test_additional_SOURCE_FILES} )
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}")
-    ENDIF(LL_TEST_VERBOSE)
+    set(${name}_test_SOURCE_FILES
+            ${source}
+            tests/${name}_test.${extension}
+            ${alltest_SOURCE_FILES}
+            ${${name}_test_additional_SOURCE_FILES} )
+    if(LL_TEST_VERBOSE)
+      message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}")
+    endif()
 
     # Headers
     GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_HEADER_FILES ${source} LL_TEST_ADDITIONAL_HEADER_FILES)
-    SET(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES})
-    LIST(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES})
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}")
-    ENDIF(LL_TEST_VERBOSE)
-    # Include dirs
+    set(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES})
+    list(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES})
+    if(LL_TEST_VERBOSE)
+      message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}")
+    endif()
+
+    # Setup target
+    add_executable(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES})
+
+    # Cannot declare a dependency on ${project} because the executable create above will later declare
+    # add_dependencies( ${project} ${project}_tests)
+    # as such grab ${project}'s interface include dirs and inject them here
+    get_property( ${name}_test_additional_INCLUDE_DIRS TARGET ${project} PROPERTY INTERFACE_INCLUDE_DIRECTORIES )
+    target_include_directories (PROJECT_${project}_TEST_${name} PRIVATE ${${name}_test_additional_INCLUDE_DIRS} )
+
     GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_INCLUDE_DIRS ${source} LL_TEST_ADDITIONAL_INCLUDE_DIRS)
-    INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${${name}_test_additional_INCLUDE_DIRS} )
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}")
-    ENDIF(LL_TEST_VERBOSE)
+    target_include_directories (PROJECT_${project}_TEST_${name} PRIVATE ${${name}_test_additional_INCLUDE_DIRS} )
 
+    target_include_directories (PROJECT_${project}_TEST_${name} PRIVATE ${LIBS_OPEN_DIR}/test )
 
-    # Setup target
-    ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES})
-    SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
+    set_target_properties(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
 
     #
     # Per-codefile additional / external project dep and lib dep property extraction
@@ -111,92 +110,95 @@ INCLUDE(GoogleMock)
     GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_PROJECTS ${source} LL_TEST_ADDITIONAL_PROJECTS)
     # Libraries
     GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_LIBRARIES ${source} LL_TEST_ADDITIONAL_LIBRARIES)
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}")
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}")
-    ENDIF(LL_TEST_VERBOSE)
+
+    if(LL_TEST_VERBOSE)
+      message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}")
+      message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}")
+    endif()
+
     # Add to project
-    TARGET_LINK_LIBRARIES(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} )
+    target_link_libraries(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} )
     add_dependencies( PROJECT_${project}_TEST_${name} ${alltest_DEP_TARGETS})
     # Compile-time Definitions
     GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_CFLAGS ${source} LL_TEST_ADDITIONAL_CFLAGS)
-    SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name}
-      PROPERTIES
-      COMPILE_FLAGS "${${name}_test_additional_CFLAGS}"
-      COMPILE_DEFINITIONS "LL_TEST=${name};LL_TEST_${name}")
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_CFLAGS ${${name}_test_additional_CFLAGS}")
-    ENDIF(LL_TEST_VERBOSE)
-     
+    set_target_properties(PROJECT_${project}_TEST_${name}
+            PROPERTIES
+            COMPILE_FLAGS "${${name}_test_additional_CFLAGS}"
+            COMPILE_DEFINITIONS "LL_TEST=${name};LL_TEST_${name}")
+    if(LL_TEST_VERBOSE)
+      message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_CFLAGS ${${name}_test_additional_CFLAGS}")
+    endif()
+
     #
     # Setup test targets
     #
-    SET(TEST_EXE $<TARGET_FILE:PROJECT_${project}_TEST_${name}>)
-    SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt)
-    SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR})
+    set(TEST_EXE $<TARGET_FILE:PROJECT_${project}_TEST_${name}>)
+    set(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt)
+    set(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR})
 
     # daveh - what configuration does this use? Debug? it's cmake-time, not build time. + poppy 2009-04-19
-    IF(LL_TEST_VERBOSE)
-      MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd  = ${TEST_CMD}")
-    ENDIF(LL_TEST_VERBOSE)
+    if(LL_TEST_VERBOSE)
+      message(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd  = ${TEST_CMD}")
+    endif()
 
     SET_TEST_PATH(LD_LIBRARY_PATH)
     LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD})
-    IF(LL_TEST_VERBOSE)
-      MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script  = ${TEST_SCRIPT_CMD}")
-    ENDIF(LL_TEST_VERBOSE)
-    # Add test 
-    ADD_CUSTOM_COMMAND(
-        OUTPUT ${TEST_OUTPUT}
-        COMMAND ${TEST_SCRIPT_CMD}
-        DEPENDS PROJECT_${project}_TEST_${name}
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-        )
+    if(LL_TEST_VERBOSE)
+      message(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script  = ${TEST_SCRIPT_CMD}")
+    endif()
+
+    # Add test
+    add_custom_command(
+            OUTPUT ${TEST_OUTPUT}
+            COMMAND ${TEST_SCRIPT_CMD}
+            DEPENDS PROJECT_${project}_TEST_${name}
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    )
     # Why not add custom target and add POST_BUILD command?
     # Slightly less uncertain behavior
     # (OUTPUT commands run non-deterministically AFAIK) + poppy 2009-04-19
-    # > I did not use a post build step as I could not make it notify of a 
+    # > I did not use a post build step as I could not make it notify of a
     # > failure after the first time you build and fail a test. - daveh 2009-04-20
-    LIST(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT})
-  ENDFOREACH (source)
+    list(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT})
+  endforeach (source)
 
   # Add the test runner target per-project
   # (replaces old _test_ok targets all over the place)
-  ADD_CUSTOM_TARGET(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT})
-  ADD_DEPENDENCIES(${project} ${project}_tests)
+  add_custom_target(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT})
+  add_dependencies(${project} ${project}_tests)
 ENDMACRO(LL_ADD_PROJECT_UNIT_TESTS)
 
 #*****************************************************************************
 #   GET_OPT_SOURCE_FILE_PROPERTY
 #*****************************************************************************
 MACRO(GET_OPT_SOURCE_FILE_PROPERTY var filename property)
-  GET_SOURCE_FILE_PROPERTY(${var} "${filename}" "${property}")
-  IF("${${var}}" MATCHES NOTFOUND)
-    SET(${var} "")
-  ENDIF("${${var}}" MATCHES NOTFOUND)
+  get_source_file_property(${var} "${filename}" "${property}")
+  if("${${var}}" MATCHES NOTFOUND)
+    set(${var} "")
+  endif()
 ENDMACRO(GET_OPT_SOURCE_FILE_PROPERTY)
 
 #*****************************************************************************
 #   LL_ADD_INTEGRATION_TEST
 #*****************************************************************************
-FUNCTION(LL_ADD_INTEGRATION_TEST 
-    testname
-    additional_source_files
-    library_dependencies
-# variable args
-    )
+FUNCTION(LL_ADD_INTEGRATION_TEST
+        testname
+        additional_source_files
+        library_dependencies
+        # variable args
+        )
   if(TEST_DEBUG)
     message(STATUS "Adding INTEGRATION_TEST_${testname} - debug output is on")
-  endif(TEST_DEBUG)
+  endif()
 
-  SET(source_files
-    tests/${testname}_test.cpp
-    ${CMAKE_SOURCE_DIR}/test/test.cpp
-    ${CMAKE_SOURCE_DIR}/test/lltut.cpp
-    ${additional_source_files}
-    )
+  set(source_files
+          tests/${testname}_test.cpp
+          ${CMAKE_SOURCE_DIR}/test/test.cpp
+          ${CMAKE_SOURCE_DIR}/test/lltut.cpp
+          ${additional_source_files}
+          )
 
-  SET(libraries
+  set(libraries
           ${library_dependencies}
           ll::googlemock
           )
@@ -204,36 +206,37 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
   # Add test executable build target
   if(TEST_DEBUG)
     message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})")
-  endif(TEST_DEBUG)
-  ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})
-  SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname}
-    PROPERTIES
-    RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}"
-    COMPILE_DEFINITIONS "LL_TEST=${testname};LL_TEST_${testname}"
-    )
+  endif()
+
+  add_executable(INTEGRATION_TEST_${testname} ${source_files})
+  set_target_properties(INTEGRATION_TEST_${testname}
+          PROPERTIES
+          RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}"
+          COMPILE_DEFINITIONS "LL_TEST=${testname};LL_TEST_${testname}"
+          )
 
-  # The following was copied to llcorehttp/CMakeLists.txt's texture_load target. 
+  # The following was copied to llcorehttp/CMakeLists.txt's texture_load target.
   # Any changes made here should be replicated there.
   if (WINDOWS)
-    SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname}
-        PROPERTIES
-        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE"
-        LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO"
-        LINK_FLAGS_RELEASE ""
-        )
-  endif (WINDOWS)
+    set_target_properties(INTEGRATION_TEST_${testname}
+            PROPERTIES
+            LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE"
+            )
+  endif ()
 
   # Add link deps to the executable
   if(TEST_DEBUG)
     message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})")
-  endif(TEST_DEBUG)
-  TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})
+  endif()
+
+  target_link_libraries(INTEGRATION_TEST_${testname} ${libraries})
+  target_include_directories (INTEGRATION_TEST_${testname} PRIVATE ${LIBS_OPEN_DIR}/test )
 
   # Create the test running command
-  SET(test_command ${ARGN})
-  SET(TEST_EXE $<TARGET_FILE:INTEGRATION_TEST_${testname}>)
-  LIST(FIND test_command "{}" test_exe_pos)
-  IF(test_exe_pos LESS 0)
+  set(test_command ${ARGN})
+  set(TEST_EXE $<TARGET_FILE:INTEGRATION_TEST_${testname}>)
+  list(FIND test_command "{}" test_exe_pos)
+  if(test_exe_pos LESS 0)
     # The {} marker means "the full pathname of the test executable."
     # test_exe_pos -1 means we didn't find it -- so append the test executable
     # name to $ARGN, the variable part of the arg list. This is convenient
@@ -242,26 +245,26 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
     # pathname of the test program as the last of its args. You need specify
     # {} only if the test program's pathname isn't the last argument in the
     # desired command line.
-    LIST(APPEND test_command "${TEST_EXE}")
-  ELSE (test_exe_pos LESS 0)
+    list(APPEND test_command "${TEST_EXE}")
+  else (test_exe_pos LESS 0)
     # Found {} marker at test_exe_pos. Remove the {}...
-    LIST(REMOVE_AT test_command test_exe_pos)
+    list(REMOVE_AT test_command test_exe_pos)
     # ...and replace it with the actual name of the test executable.
-    LIST(INSERT test_command test_exe_pos "${TEST_EXE}")
-  ENDIF (test_exe_pos LESS 0)
+    list(INSERT test_command test_exe_pos "${TEST_EXE}")
+  endif()
 
   SET_TEST_PATH(LD_LIBRARY_PATH)
   LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command})
 
   if(TEST_DEBUG)
     message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}")
-  endif(TEST_DEBUG)
+  endif()
 
-  ADD_CUSTOM_COMMAND(
-    TARGET INTEGRATION_TEST_${testname}
-    POST_BUILD
-    COMMAND ${TEST_SCRIPT_CMD}
-    )
+  add_custom_command(
+          TARGET INTEGRATION_TEST_${testname}
+          POST_BUILD
+          COMMAND ${TEST_SCRIPT_CMD}
+  )
 
   # Use CTEST? Not sure how to yet...
   # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD})
diff --git a/indra/cmake/LLMath.cmake b/indra/cmake/LLMath.cmake
index 893920ae6fbcb6da5bbdce10e65e0dd58b717733..a707c75bc415d8133c29a5a016950d7a25dff1a3 100644
--- a/indra/cmake/LLMath.cmake
+++ b/indra/cmake/LLMath.cmake
@@ -1,7 +1,2 @@
 # -*- cmake -*-
 
-set(LLMATH_INCLUDE_DIRS
-    ${LIBS_OPEN_DIR}/llmath
-    )
-
-set(LLMATH_LIBRARIES llmath)
diff --git a/indra/integration_tests/llimage_libtest/CMakeLists.txt b/indra/integration_tests/llimage_libtest/CMakeLists.txt
index cf43292922afb37171fbb8e3d654aa5a165a7432..ee2890778b45ce72e2bde5a68bf33362ca20b494 100644
--- a/indra/integration_tests/llimage_libtest/CMakeLists.txt
+++ b/indra/integration_tests/llimage_libtest/CMakeLists.txt
@@ -12,16 +12,6 @@ include(LLImageJ2COJ)
 include(LLKDU)
 include(LLFileSystem)
 
-include_directories(
-    ${LLCOMMON_INCLUDE_DIRS}
-    ${LLFILESYSTEM_INCLUDE_DIRS}
-    ${LLIMAGE_INCLUDE_DIRS}
-    ${LLMATH_INCLUDE_DIRS}
-    )
-include_directories(SYSTEM
-    ${LLCOMMON_SYSTEM_INCLUDE_DIRS}
-    )
-
 set(llimage_libtest_SOURCE_FILES
     llimage_libtest.cpp
     )
diff --git a/indra/integration_tests/llui_libtest/CMakeLists.txt b/indra/integration_tests/llui_libtest/CMakeLists.txt
index 849eda1acf9d9235a067668fe9ecd04344c2944d..a6ce657f4f3458e844edf12e186113bfbf225878 100644
--- a/indra/integration_tests/llui_libtest/CMakeLists.txt
+++ b/indra/integration_tests/llui_libtest/CMakeLists.txt
@@ -22,23 +22,6 @@ include(Hunspell)
 include(Linking)
 # include(Tut)
 
-include_directories(
-    ${FREETYPE_INCLUDE_DIRS}
-    ${LLCOMMON_INCLUDE_DIRS}
-    ${LLIMAGE_INCLUDE_DIRS}
-    ${LLMATH_INCLUDE_DIRS}
-    ${LLRENDER_INCLUDE_DIRS}
-    ${LLUI_INCLUDE_DIRS}
-    ${LLFILESYSTEM_INCLUDE_DIRS}
-    ${LLWINDOW_INCLUDE_DIRS}
-    ${LLXML_INCLUDE_DIRS}
-    ${LIBS_PREBUILD_DIR}/include/hunspell
-    )
-include_directories(SYSTEM
-    ${LLCOMMON_SYSTEM_INCLUDE_DIRS}
-    ${LLXML_SYSTEM_INCLUDE_DIRS}
-    )
-
 set(llui_libtest_SOURCE_FILES
     llui_libtest.cpp
     llwidgetreg.cpp
diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt
index 08139910d30dab8204c760e35fe36a03a0a2a5ba..87796abd3c631615bc7cd72d612b841add0cfc87 100644
--- a/indra/llcorehttp/CMakeLists.txt
+++ b/indra/llcorehttp/CMakeLists.txt
@@ -14,8 +14,6 @@ include(LLCommon)
 include(Tut)
 include(bugsplat)
 
-include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../llmessage )
-
 set(llcorehttp_SOURCE_FILES
     bufferarray.cpp
     bufferstream.cpp
@@ -89,8 +87,11 @@ target_link_libraries(
         ll::openssl
         ll::nghttp2
   )
-target_include_directories( llcorehttp  INTERFACE   ${CMAKE_CURRENT_SOURCE_DIR})
-
+target_include_directories( llcorehttp INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+# llmessage depends on llcorehttp, yet llcorehttp also depends on llmessage (at least for includes).
+# Cannot/Should not use target_link_libraries here to add llmessage to the dependencies, as that would
+# lead to circular dependencies (or in case of cmake, the first project declaring it's dependencies wins)
+target_include_directories( llcorehttp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../llmessage)
 
 # tests
 set(LLCOREHTTP_TESTS ON CACHE BOOL
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt
index 7340752fb24256c1c0fb9ef32c08b4f6aa168e56..4786956e85f20957cd6c76ac9768232057b27ef2 100644
--- a/indra/llmessage/CMakeLists.txt
+++ b/indra/llmessage/CMakeLists.txt
@@ -13,8 +13,6 @@ include(Tut)
 include(Python)
 include(JsonCpp)
 
-include_directories (${CMAKE_CURRENT_SOURCE_DIR})
-
 set(llmessage_SOURCE_FILES
     llassetstorage.cpp
     llavatarname.cpp
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 966630d1fc12116eab0ade3094a07464eb460b15..ed495ed8b394512097a4a12f14d22d08d87469ab 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -47,8 +47,6 @@ include(ZLIBNG)
 include(URIPARSER)
 include(LLPrimitive)
 
-include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
-
 if (NOT HAVOK_TPV)
    # When using HAVOK_TPV, the library is precompiled, so no need for this
 
@@ -1422,15 +1420,6 @@ if (WINDOWS)
          llwindebug.h
          )
 
-    # precompiled header configuration
-    # llviewerprecompiledheaders.cpp generates
-    # the .pch file.
-    # All sources added to viewer_SOURCE_FILES
-    # at this point use it.
-    if(USE_PRECOMPILED_HEADERS)
-       set(viewer_SOURCE_FILES "${viewer_SOURCE_FILES}" llviewerprecompiledheaders.cpp)
-    endif(USE_PRECOMPILED_HEADERS)
-
     # Replace the icons with the appropriate ones for the channel
     # ('test' is the default)
     set(ICON_PATH "test")
@@ -2265,26 +2254,9 @@ if (LL_TESTS)
           LL_TEST_ADDITIONAL_LIBRARIES ${test_libs}
   )
 
-  ##################################################
-  # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS
-  ##################################################
-  # if(USE_PRECOMPILED_HEADERS)
-  #     set_source_files_properties(
-  #       ${viewer_TEST_SOURCE_FILES}
-  #       PROPERTIES
-  #         LL_TEST_ADDITIONAL_SOURCE_FILES llviewerprecompiledheaders.cpp
-  #       )
-  # endif(USE_PRECOMPILED_HEADERS)
   LL_ADD_PROJECT_UNIT_TESTS(${VIEWER_BINARY_NAME} "${viewer_TEST_SOURCE_FILES}")
 
   #set(TEST_DEBUG on)
-  ##################################################
-  # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS
-  ##################################################
-  # if(USE_PRECOMPILED_HEADERS)
-  #     set(test_sources "${test_sources}" llviewerprecompiledheaders.cpp)
-  # endif(USE_PRECOMPILED_HEADERS)
-
 
   set(test_libs
           llfilesystem
diff --git a/indra/newview/llviewerprecompiledheaders.cpp b/indra/newview/llviewerprecompiledheaders.cpp
deleted file mode 100644
index 307e9037269a6c6e4b7de41fcd8d58f4a13cd26a..0000000000000000000000000000000000000000
--- a/indra/newview/llviewerprecompiledheaders.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/** 
- * @file llviewerprecompiledheaders.cpp
- * @brief precompiled headers for newview project
- *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-// source file that includes just the standard includes
-// newview.pch will be the pre-compiled header
-// llviewerprecompiledheaders.obj will contain the pre-compiled type information
-
-#include "llviewerprecompiledheaders.h"
-
-// TODO: reference any additional headers you need in llviewerprecompiledheaders.h
-// and not in this file