1# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2# file Copyright.txt or https://cmake.org/licensing for details.
3
4#[=======================================================================[.rst:
5FindRTI
6-------
7
8Try to find M&S HLA RTI libraries
9
10This module finds if any HLA RTI is installed and locates the standard
11RTI include files and libraries.
12
13RTI is a simulation infrastructure standardized by IEEE and SISO.  It
14has a well defined C++ API that assures that simulation applications
15are independent on a particular RTI implementation.
16
17::
18
19  http://en.wikipedia.org/wiki/Run-Time_Infrastructure_(simulation)
20
21
22
23This code sets the following variables:
24
25::
26
27  RTI_INCLUDE_DIR = the directory where RTI includes file are found
28  RTI_LIBRARIES = The libraries to link against to use RTI
29  RTI_DEFINITIONS = -DRTI_USES_STD_FSTREAM
30  RTI_FOUND = Set to FALSE if any HLA RTI was not found
31
32
33
34Report problems to <[email protected]>
35#]=======================================================================]
36
37macro(RTI_MESSAGE_QUIETLY QUIET TYPE MSG)
38  if(NOT ${QUIET})
39    message(${TYPE} "${MSG}")
40  endif()
41endmacro()
42
43set(RTI_DEFINITIONS "-DRTI_USES_STD_FSTREAM")
44
45# Detect the CERTI installation, http://www.cert.fr/CERTI
46# Detect the MAK Technologies RTI installation, http://www.mak.com/products/rti.php
47# note: the following list is ordered to find the most recent version first
48set(RTI_POSSIBLE_DIRS
49  ENV CERTI_HOME
50  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MAK Technologies\\MAK RTI 3.2 MSVC++ 8.0;Location]"
51  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MAK RTI 3.2-win32-msvc++8.0;InstallLocation]"
52  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MAK Technologies\\MAK RTI 2.2;Location]"
53  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MAK RTI 2.2;InstallLocation]")
54
55set(RTI_OLD_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
56# The MAK RTI has the "lib" prefix even on Windows.
57set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
58
59find_library(RTI_LIBRARY
60  NAMES RTI RTI-NG
61  PATHS ${RTI_POSSIBLE_DIRS}
62  PATH_SUFFIXES lib
63  DOC "The RTI Library")
64
65if (RTI_LIBRARY)
66  set(RTI_LIBRARIES ${RTI_LIBRARY})
67  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI library found: ${RTI_LIBRARY}")
68else ()
69  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI library NOT found")
70endif ()
71
72find_library(RTI_FEDTIME_LIBRARY
73  NAMES FedTime
74  PATHS ${RTI_POSSIBLE_DIRS}
75  PATH_SUFFIXES lib
76  DOC "The FedTime Library")
77
78if (RTI_FEDTIME_LIBRARY)
79  set(RTI_LIBRARIES ${RTI_LIBRARIES} ${RTI_FEDTIME_LIBRARY})
80  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI FedTime found: ${RTI_FEDTIME_LIBRARY}")
81endif ()
82
83find_path(RTI_INCLUDE_DIR
84  NAMES RTI.hh
85  PATHS ${RTI_POSSIBLE_DIRS}
86  PATH_SUFFIXES include
87  DOC "The RTI Include Files")
88
89if (RTI_INCLUDE_DIR)
90  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI headers found: ${RTI_INCLUDE_DIR}")
91else ()
92  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI headers NOT found")
93endif ()
94
95# Set the modified system variables back to the original value.
96set(CMAKE_FIND_LIBRARY_PREFIXES "${RTI_OLD_FIND_LIBRARY_PREFIXES}")
97
98include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
99FIND_PACKAGE_HANDLE_STANDARD_ARGS(RTI DEFAULT_MSG
100  RTI_LIBRARY RTI_INCLUDE_DIR)
101
102# $Id$
103