File: FindRTI.cmake

package info (click to toggle)
cmake 4.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 152,312 kB
  • sloc: ansic: 403,890; cpp: 303,778; sh: 4,097; python: 3,582; yacc: 3,106; lex: 1,279; f90: 534; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 235; objc: 215; perl: 213; xml: 198; makefile: 108; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (134 lines) | stat: -rw-r--r-- 4,187 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindRTI
-------

Finds HLA RTI standard libraries and their include directories:

.. code-block:: cmake

  find_package(RTI [...])

`RTI <https://en.wikipedia.org/wiki/Run-time_infrastructure_(simulation)>`_
(Run-Time Infrastructure) is a simulation infrastructure standardized by IEEE
and SISO, required when implementing HLA (High Level Architecture).  It provides
a well-defined C++ API, ensuring that M&S (Modeling and Simulation) applications
remain independent of a particular RTI implementation.

Result Variables
^^^^^^^^^^^^^^^^

This module defines the following variables:

``RTI_FOUND``
  Boolean indicating whether HLA RTI was found.
``RTI_LIBRARIES``
  The libraries to link against to use RTI.
``RTI_DEFINITIONS``
  Compile definitions for using RTI.  Default value is set to
  ``-DRTI_USES_STD_FSTREAM``.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

``RTI_INCLUDE_DIR``
  Directory where RTI include files are found.

Examples
^^^^^^^^

Finding RTI and creating an imported interface target for linking it to a
project target:

.. code-block:: cmake

  find_package(RTI)

  if(RTI_FOUND AND NOT TARGET RTI::RTI)
    add_library(RTI::RTI INTERFACE IMPORTED)
    set_target_properties(
      RTI::RTI
      PROPERTIES
        INTERFACE_INCLUDE_DIRECTORIES "${RTI_INCLUDE_DIR}"
        INTERFACE_LINK_LIBRARIES "${RTI_LIBRARIES}"
        INTERFACE_COMPILE_DEFINITIONS "${RTI_DEFINITIONS}"
    )
  endif()

  target_link_libraries(example PRIVATE RTI::RTI)
#]=======================================================================]

macro(RTI_MESSAGE_QUIETLY QUIET TYPE MSG)
  if(NOT ${QUIET})
    message(${TYPE} "${MSG}")
  endif()
endmacro()

set(RTI_DEFINITIONS "-DRTI_USES_STD_FSTREAM")

# noqa: spellcheck off
# Detect the CERTI installation:
#   - https://www.nongnu.org/certi/
#   - Mailing list for reporting issues and development discussions:
#     <certi-devel@nongnu.org>
# Detect the MAK Technologies RTI installation:
#   - https://www.mak.com/mak-one/tools/mak-rti
# note: the following list is ordered to find the most recent version first
set(RTI_POSSIBLE_DIRS
  ENV CERTI_HOME
  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MAK Technologies\\MAK RTI 3.2 MSVC++ 8.0;Location]"
  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MAK RTI 3.2-win32-msvc++8.0;InstallLocation]"
  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MAK Technologies\\MAK RTI 2.2;Location]"
  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MAK RTI 2.2;InstallLocation]")

set(RTI_OLD_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
# The MAK RTI has the "lib" prefix even on Windows.
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
# noqa: spellcheck on

find_library(RTI_LIBRARY
  NAMES RTI RTI-NG
  PATHS ${RTI_POSSIBLE_DIRS}
  PATH_SUFFIXES lib
  DOC "The RTI Library")

if (RTI_LIBRARY)
  set(RTI_LIBRARIES ${RTI_LIBRARY})
  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI library found: ${RTI_LIBRARY}")
else ()
  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI library NOT found")
endif ()

find_library(RTI_FEDTIME_LIBRARY
  NAMES FedTime
  PATHS ${RTI_POSSIBLE_DIRS}
  PATH_SUFFIXES lib
  DOC "The FedTime Library")

if (RTI_FEDTIME_LIBRARY)
  set(RTI_LIBRARIES ${RTI_LIBRARIES} ${RTI_FEDTIME_LIBRARY})
  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI FedTime found: ${RTI_FEDTIME_LIBRARY}")
endif ()

find_path(RTI_INCLUDE_DIR
  NAMES RTI.hh
  PATHS ${RTI_POSSIBLE_DIRS}
  PATH_SUFFIXES include
  DOC "The RTI Include Files")

if (RTI_INCLUDE_DIR)
  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI headers found: ${RTI_INCLUDE_DIR}")
else ()
  RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI headers NOT found")
endif ()

# Set the modified system variables back to the original value.
set(CMAKE_FIND_LIBRARY_PREFIXES "${RTI_OLD_FIND_LIBRARY_PREFIXES}")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(RTI DEFAULT_MSG
  RTI_LIBRARY RTI_INCLUDE_DIR)