From a9021607235444c7b660985fdc35094c9782060f Mon Sep 17 00:00:00 2001
From: Aleric Inglewood <Aleric.Inglewood@gmail.com>
Date: Thu, 16 Dec 2010 15:43:18 +0100
Subject: [PATCH] VWR-24251: Fix -DLL_TESTS:BOOL=ON on standalone when Tut is
 installed in a non-standard directory.

If tut/tut.hpp isn't installed in a standard include directory all tests
fail because the found include directory for tut isn't passed to the compiler.

This patch fixes this by passing it.
Note that using include_directories() in a Find*.cmake file is bad practise.
The correct way is to set an include dir variable and call
include_directories() once. It certainly doesn't work for the tests anyway
because the tests are all over the place and include_directories is on a
per folder basis.  What is needed is to set it for each (test) target.

However, there is no TARGET_INCLUDE_DIRECTORIES. The closest thing that we
have is to set the COMPILE_FLAGS property for a target.

Fortunately, standalone is only used for linux, so we can just use
-I${TUT_INCLUDE_DIR} to get the effect we want.
---
 doc/contributions.txt            | 1 +
 indra/cmake/LLAddBuildTest.cmake | 3 +++
 indra/cmake/Tut.cmake            | 1 -
 indra/test/CMakeLists.txt        | 1 +
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/doc/contributions.txt b/doc/contributions.txt
index 05e5e0f43cb..f33af2599dd 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -75,6 +75,7 @@ Aleric Inglewood
 	VWR-13996
 	VWR-14426
 	VWR-24247
+	VWR-24251
 	VWR-24252
 	SNOW-84
 	SNOW-477
diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake
index 29e2492551c..62b764bb307 100644
--- a/indra/cmake/LLAddBuildTest.cmake
+++ b/indra/cmake/LLAddBuildTest.cmake
@@ -205,6 +205,9 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
   endif(TEST_DEBUG)
   ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})
   SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
+  if(STANDALONE)
+    SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}")
+  endif(STANDALONE)
 
   # Add link deps to the executable
   if(TEST_DEBUG)
diff --git a/indra/cmake/Tut.cmake b/indra/cmake/Tut.cmake
index 784560471d5..738c08c42fe 100644
--- a/indra/cmake/Tut.cmake
+++ b/indra/cmake/Tut.cmake
@@ -6,7 +6,6 @@ set(TUT_FIND_QUIETLY TRUE)
 
 if (STANDALONE)
   include(FindTut)
-  include_directories(${TUT_INCLUDE_DIR})
 else (STANDALONE)
   use_prebuilt_binary(tut)
 endif (STANDALONE)
diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt
index 66c78a86c4e..e9eb3c18844 100644
--- a/indra/test/CMakeLists.txt
+++ b/indra/test/CMakeLists.txt
@@ -27,6 +27,7 @@ include_directories(
     ${LLXML_INCLUDE_DIRS}
     ${LSCRIPT_INCLUDE_DIRS}
     ${GOOGLEMOCK_INCLUDE_DIRS}
+    ${TUT_INCLUDE_DIR}
     )
 
 set(test_SOURCE_FILES
-- 
GitLab