From d2e914c92e851ce3e0cc349dd3d707751d3abfc1 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Thu, 30 Sep 2010 15:03:40 +0200 Subject: RED-573: FindTut.cmake is missing: tut.h is not searched for. This patch only affects --standalone. It was basically ported from Snowglobe with the following change: If LL_TESTS is not set, then tut.h is not required (this is an improvement, because if LL_TESTS is not set no tests should be created or run). I tested it with -DLL_TESTS:BOOL=ON, -DLL_TESTS:BOOL=OFF and no -DLL_TESTS* at all, with and without tut installed, internally and externally. Things worked as expected. Most notably, with tut.h installed in libraries/include/, it is NOT found. This is necessary because using -Ilibraries/include for standalone is a no no: prebuilt stuff might be downloaded, but we don't want to use it! That directory contains potentially many other libraries. --- linden/indra/cmake/FindTut.cmake | 33 +++++++++++++++++++++++++++++++++ linden/indra/cmake/Tut.cmake | 15 +++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 linden/indra/cmake/FindTut.cmake (limited to 'linden/indra') diff --git a/linden/indra/cmake/FindTut.cmake b/linden/indra/cmake/FindTut.cmake new file mode 100644 index 0000000..5ac7ec0 --- /dev/null +++ b/linden/indra/cmake/FindTut.cmake @@ -0,0 +1,33 @@ +# -*- cmake -*- + +# - Find Tut +# Find the Tut unit test framework includes and library +# This module defines +# TUT_INCLUDE_DIR, where to find tut/tut.hpp, etc. +# TUT_FOUND, If false, do not try to use Tut. + +find_path(TUT_INCLUDE_DIR tut/tut.hpp + NO_SYSTEM_ENVIRONMENT_PATH +) + +IF (TUT_INCLUDE_DIR) + SET(TUT_FOUND "YES") +ELSE (TUT_INCLUDE_DIR) + SET(TUT_FOUND "NO") +ENDIF (TUT_INCLUDE_DIR) + +IF (TUT_FOUND) + IF (NOT TUT_FIND_QUIETLY) + MESSAGE(STATUS "Found Tut: ${TUT_INCLUDE_DIR}") + SET(TUT_FIND_QUIETLY TRUE) # Only alert us the first time + ENDIF (NOT TUT_FIND_QUIETLY) +ELSE (TUT_FOUND) + IF (TUT_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Tut") + ENDIF (TUT_FIND_REQUIRED) +ENDIF (TUT_FOUND) + +MARK_AS_ADVANCED( + TUT_INCLUDE_DIR +) + diff --git a/linden/indra/cmake/Tut.cmake b/linden/indra/cmake/Tut.cmake index 7488e9d..118c72e 100644 --- a/linden/indra/cmake/Tut.cmake +++ b/linden/indra/cmake/Tut.cmake @@ -1,6 +1,17 @@ # -*- cmake -*- include(Prebuilt) -if (NOT STANDALONE) +SET(TUT_FIND_REQUIRED FALSE) +SET(TUT_FIND_QUIETLY TRUE) + +if (STANDALONE) + if (LL_TESTS) + SET(TUT_FIND_REQUIRED TRUE) + endif (LL_TESTS) + include(FindTut) + if (TUT_FOUND) + include_directories(${TUT_INCLUDE_DIR}) + endif (TUT_FOUND) +else (STANDALONE) use_prebuilt_binary(tut) -endif(NOT STANDALONE) +endif(STANDALONE) -- cgit v1.1