Debian Codegraph @

CMakeModules/SetupFGFSLibraries.cmake

raw
1 function(setup_fgfs_libraries target)
2 if(RTI_FOUND)
3 set(HLA_LIBRARIES ${RTI_LDFLAGS})
4 else()
5 set(HLA_LIBRARIES "")
6 endif()
7
8 if(ENABLE_JSBSIM)
9 target_link_libraries(${target} JSBSim)
10 endif()
11
12 if(ENABLE_IAX)
13 target_link_libraries(${target} iaxclient_lib)
14 endif()
15
16 if(HAVE_DBUS)
17 # ALIAS doesn't work with CMake 3.10, so we need
18 # variable to store the target name
19 target_link_libraries(${target} ${dbus_target})
20 endif()
21
22 if(X11_FOUND)
23 target_link_libraries(${target} ${X11_LIBRARIES})
24 endif()
25
26 if(ENABLE_OSGXR)
27 target_link_libraries(${target} osgXR)
28 endif()
29
30 target_link_libraries(${target} fgsqlite3 fgvoicesynth fgembeddedresources)
31
32 target_link_libraries(${target}
33 SimGearCore
34 SimGearScene
35 Boost::boost
36 ${EVENT_INPUT_LIBRARIES}
37 ${HLA_LIBRARIES}
38 ${OPENGL_LIBRARIES}
39 ${OPENSCENEGRAPH_LIBRARIES}
40 ${PLATFORM_LIBS}
41 ${PLIB_LIBRARIES}
42 )
43
44 if (ENABLE_SWIFT)
45 # ALIAS doesn't work with CMake 3.10, so we need
46 # variable to store the target name
47 target_link_libraries(${target} ${dbus_target} ${libEvent_target})
48 endif()
49
50 if (ENABLE_PLIB_JOYSTICK)
51 target_link_libraries(${target} PLIBJoystick)
52 endif()
53
54 target_link_libraries(${target} PLIBFont)
55
56 if (HAVE_QT)
57 target_link_libraries(${target} fglauncher fgqmlui)
58 endif()
59
60 if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
61 target_link_libraries(${target} execinfo)
62 endif()
63
64 if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
65 target_link_libraries(${target} execinfo)
66 endif()
67
68 if (TARGET sentry::sentry)
69 target_link_libraries(${target} sentry::sentry)
70 endif()
71 endfunction()
72
73
74 # CMake < 3.12 can't define a link to an OBJECT library to specify its include
75 # paths, so we have to essentially duplicate the above and configure the paths manually.
76 # Once we require CMake 3.12, delete all this and use the function above.
77
78 function (_apply_target_includes dest target)
79 if (NOT TARGET ${target})
80 return()
81 endif()
82
83 # retrieve the list of includes from the target
84 get_target_property(includes ${target} INTERFACE_INCLUDE_DIRECTORIES)
85
86 foreach(i ${includes})
87 # skip any invalid includes
88 if (NOT i)
89 return()
90 endif()
91
92 target_include_directories(${dest} PUBLIC ${i})
93 endforeach()
94
95 # retrieve the list of system includes from the target
96 get_target_property(includes ${target} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
97
98 foreach(i ${includes})
99 # skip any invalid includes
100 if (NOT i)
101 return()
102 endif()
103
104 target_include_directories(${dest} SYSTEM PUBLIC ${i})
105 endforeach()
106 endfunction()
107
108 function (_apply_all_target_includes dest)
109 foreach(arg IN LISTS ARGN)
110 _apply_target_includes(${dest} ${arg})
111 endforeach()
112 endfunction()
113
114 function (setup_fgfs_library_includes target)
115
116 _apply_all_target_includes(${target}
117 SimGearCore
118 SimGearScene
119 Boost::boost
120 ${EVENT_INPUT_LIBRARIES}
121 ${HLA_LIBRARIES}
122 ${OPENGL_LIBRARIES}
123 ${OPENSCENEGRAPH_LIBRARIES}
124 ${PLATFORM_LIBS}
125 ${PLIB_LIBRARIES}
126 )
127
128 if(ENABLE_JSBSIM)
129 _apply_target_includes(${target} JSBSim)
130 endif()
131
132 if(ENABLE_OSGXR)
133 _apply_target_includes(${target} osgXR)
134 endif()
135
136 _apply_target_includes(${target} fgsqlite3)
137 _apply_target_includes(${target} fgvoicesynth)
138 _apply_target_includes(${target} fgembeddedresources)
139
140 if(ENABLE_IAX)
141 _apply_target_includes(${target} iaxclient_lib)
142 endif()
143
144 if (ENABLE_SWIFT)
145 _apply_all_target_includes(${target} ${dbus_target} ${libEvent_target})
146 elseif(HAVE_DBUS)
147 _apply_all_target_includes(${target} ${dbus_target})
148 endif()
149
150 if (ENABLE_PLIB_JOYSTICK)
151 _apply_target_includes(${target} PLIBJoystick)
152 endif()
153
154 _apply_target_includes(${target} PLIBFont)
155
156 if (TARGET sentry::sentry)
157 _apply_target_includes(${target} sentry::sentry)
158 endif()
159
160 endfunction()