1# - Try to find C++ TR1 headers and libraries
2# Once done, this will define
3#
4#  TR1_USE_FILE, which you may "include" in your CMake file to be able
5#   to use TR1 features transparently
6#  TR1_INCLUDE_DIRS, any directories needed to access TR1 headers
7#  TR1_LIBRARY_DIRS, any directories needed to access (auto-link) TR1 libraries
8#  TR1_FOUND, If false, do not try to use TR1 features.
9#
10# If TR1 features are not built-in, we will try to use Boost to
11# substitute for them.
12#
13# Original Author:
14# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
15# http://academic.cleardefinition.com
16# Iowa State University HCI Graduate Program/VRAC
17#
18# Copyright Iowa State University 2009-2010.
19# Distributed under the Boost Software License, Version 1.0.
20# (See accompanying file LICENSE_1_0.txt or copy at
21# http://www.boost.org/LICENSE_1_0.txt)
22
23# If we were sought quietly, any dependencies should be quiet as well
24if(TR1_FIND_QUIETLY)
25	set(_findflags QUIET)
26else()
27	set(_findflags)
28endif()
29
30set(_check)
31set(TR1_INCLUDE_DIRS)
32set(TR1_LIBRARY_DIRS)
33
34get_filename_component(_findtr1moddir
35	${CMAKE_CURRENT_LIST_FILE}
36	PATH)
37set(TR1_USE_FILE "${_findtr1moddir}/UseTR1.cmake")
38
39if(WIN32)
40	if(MSVC)
41		set(PLATFORM "Visual Studio - no workarounds")
42	else()
43		set(PLATFORM "Unknown Windows platform - no workarounds set")
44	endif()
45
46	if(MSVC_VERSION LESS 1600)
47		# Earlier than VS 2010
48		# Missing stdint.h/cstdint
49		set(PLATFORM "Visual Studio older than Visual Studio 2010")
50	endif()
51
52	if(MSVC_VERSION LESS 1500)
53		# Earlier than VS 2008
54		# Missing all of TR1
55		# (The feature pack or SP1 is required for VS2008 TR support)
56		set(PLATFORM "Visual Studio older than Visual Studio 2008")
57		list(APPEND _check Boost_FOUND)
58		find_package(Boost COMPONENTS math_c99 math_tr1 ${_findflags})
59		list(APPEND
60			TR1_INCLUDE_DIRS
61			"${Boost_INCLUDE_DIR}/boost/tr1/tr1"
62			"${Boost_INCLUDE_DIR}/boost/tr1"
63			"${Boost_INCLUDE_DIR}")
64		list(APPEND TR1_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
65	endif()
66else()
67	set(PLATFORM "Non-Windows Platform - no workarounds set")
68endif()
69
70# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if
71# all listed variables are TRUE
72include(FindPackageHandleStandardArgs)
73find_package_handle_standard_args(TR1 DEFAULT_MSG PLATFORM ${_check})
74