@@ -35,8 +35,41 @@ project(XPMP2
35
35
VERSION 3.4.0
36
36
DESCRIPTION "Multiplayer library for X-Plane 11 and 12" )
37
37
38
+ # Source list
39
+ add_library (XPMP2 STATIC
40
+ inc/XPCAircraft.h
41
+ inc/XPMPAircraft.h
42
+ inc/XPMPMultiplayer.h
43
+ inc/XPMPRemote.h
44
+ inc/XPMPPlaneRenderer.h
45
+ src/2D.h
46
+ src/2D.cpp
47
+ src/AIMultiplayer.h
48
+ src/AIMultiplayer.cpp
49
+ src/Aircraft.h
50
+ src/Aircraft.cpp
51
+ src/Contrail.cpp
52
+ src/CSLCopy.cpp
53
+ src/CSLModels.h
54
+ src/CSLModels.cpp
55
+ src/Map.h
56
+ src/Map.cpp
57
+ src/Network.h
58
+ src/Network.cpp
59
+ src/RelatedDoc8643.h
60
+ src/RelatedDoc8643.cpp
61
+ src/Remote.h
62
+ src/Remote.cpp
63
+ src/Sound.h
64
+ src/Sound.cpp
65
+ src/Utilities.h
66
+ src/Utilities.cpp
67
+ src/XPMP2.h
68
+ src/XPMPMultiplayer.cpp
69
+ )
70
+
38
71
# Provide compile macros from the above project version definition
39
- add_compile_definitions (
72
+ target_compile_definitions ( XPMP2 PRIVATE
40
73
XPMP2_VERSION= "${PROJECT_VERSION} "
41
74
XPMP2_VER_MAJOR=${PROJECT_VERSION_MAJOR}
42
75
XPMP2_VER_MINOR=${PROJECT_VERSION_MINOR}
@@ -61,72 +94,69 @@ endif()
61
94
62
95
# Windows: Target Windows 7.0 and later
63
96
if (WIN32 )
64
- add_compile_definitions ( _WIN32_WINNT=0x0601 )
97
+ target_compile_definitions ( XPMP2 PRIVATE _WIN32_WINNT=0x0601 )
65
98
if (NOT DEFINED ENV{platform} )
66
99
set (ENV{platform} "win" )
67
100
endif ()
68
101
elseif (APPLE )
69
102
# MacOS 10.15 is minimum system requirement for X-Plane 12
70
103
set (CMAKE_OSX_DEPLOYMENT_TARGET 10.15 )
71
- add_compile_options ( -mmacosx-version-min=10.15 )
72
- add_link_options ( -mmacosx-version-min=10.15 )
104
+ target_compile_options ( XPMP2 PRIVATE -mmacosx-version-min=10.15 )
105
+ target_link_options ( XPMP2 PRIVATE -mmacosx-version-min=10.15 )
73
106
endif ()
74
107
75
108
################################################################################
76
109
# C++ Standard required
77
110
################################################################################
78
111
79
- set (CMAKE_CXX_STANDARD 17 )
80
- set_property (GLOBAL PROPERTY CXX_STANDARD_REQUIRED 17 )
81
- set_property (GLOBAL PROPERTY CXX_STANDARD 17 )
112
+ set_property (TARGET XPMP2 PROPERTY CXX_STANDARD 17 )
82
113
83
114
################################################################################
84
115
# Compile Options
85
116
################################################################################
86
117
87
118
# Enable all X-Plane SDK APIs up to the newest version.
88
- add_compile_definitions ( XPLM200=1 XPLM210=1 XPLM300=1 XPLM301=1 XPLM303=1 XPLM400=1 )
119
+ target_compile_definitions ( XPMP2 PUBLIC XPLM200=1 XPLM210=1 XPLM300=1 XPLM301=1 XPLM303=1 XPLM400=1 )
89
120
90
121
# Define platform macros.
91
- add_compile_definitions ( APL=$<BOOL:${APPLE}> IBM=$<BOOL:${WIN32}> LIN=$<AND:$<BOOL:${UNIX}>,$<NOT:$<BOOL:${APPLE}>>> )
122
+ target_compile_definitions ( XPMP2 PUBLIC APL=$<BOOL:${APPLE}> IBM=$<BOOL:${WIN32}> LIN=$<AND:$<BOOL:${UNIX}>,$<NOT:$<BOOL:${APPLE}>>> )
92
123
93
124
# Enable stricter warnings and then disable some we are not interested in.
94
125
# For XPMP2 compile, we don't need to be warned about our self-defined depreciations
95
126
if (MSVC )
96
- add_compile_options ( /wd4996 /wd4068 )
97
- add_compile_definitions ( _CRT_SECURE_NO_WARNINGS )
127
+ target_compile_options ( XPMP2 PRIVATE /wd4996 /wd4068 )
128
+ target_compile_definitions ( XPMP2 PRIVATE _CRT_SECURE_NO_WARNINGS )
98
129
else ()
99
- add_compile_options ( -Wall -Wshadow -Wextra -Wno-deprecated-declarations )
130
+ target_compile_options ( XPMP2 PRIVATE -Wall -Wshadow -Wextra -Wno-deprecated-declarations )
100
131
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0 AND NOT APPLE )
101
- add_compile_options ( -Wno-stringop-truncation )
132
+ target_compile_options ( XPMP2 PRIVATE -Wno-stringop-truncation )
102
133
endif ()
103
134
104
135
# Force-enable exception support. This is most likely redundant, although for C
105
136
# code the default is the opposite. Since we are mixing C++ and C libraries,
106
137
# safer to set it on?
107
- add_compile_options ( -fexceptions )
138
+ target_compile_options ( XPMP2 PRIVATE -fexceptions )
108
139
109
140
# Makes symbols non-exported by default.
110
- add_compile_options ( -fvisibility=hidden )
141
+ target_compile_options ( XPMP2 PRIVATE -fvisibility=hidden )
111
142
endif ()
112
143
113
-
114
144
# Debug vs Release build
115
145
if (CMAKE_BUILD_TYPE MATCHES "Debug" )
116
- add_compile_definitions ( DEBUG=1 )
146
+ target_compile_definitions ( XPMP2 PRIVATE DEBUG=1 )
117
147
if (MSVC )
118
- add_compile_options ( /Zi )
148
+ target_compile_options ( XPMP2 PRIVATE /Zi )
119
149
else ()
120
- add_compile_options ( -O0 -g -fPIC )
150
+ target_compile_options ( XPMP2 PRIVATE -O0 -g -fPIC )
121
151
endif ()
122
152
else ()
123
- add_compile_definitions ( NDEBUG=1 )
153
+ target_compile_definitions ( XPMP2 PRIVATE NDEBUG=1 )
124
154
if (MSVC )
125
155
# Fast code, symbols into separate .pdb file, no global optimization (as it produces huge files)
126
- add_compile_options ( /Zi /O2 /GL- )
156
+ target_compile_options ( XPMP2 PRIVATE /Zi /O2 /GL- )
127
157
else ()
128
158
# Use position-independent code and highest optimization level
129
- add_compile_options ( -O3 -fPIC )
159
+ target_compile_options ( XPMP2 PRIVATE -O3 -fPIC )
130
160
endif ()
131
161
endif ()
132
162
@@ -140,39 +170,6 @@ endif()
140
170
# XPMP2 Library
141
171
################################################################################
142
172
143
- # Source list
144
- add_library (XPMP2 STATIC
145
- inc/XPCAircraft.h
146
- inc/XPMPAircraft.h
147
- inc/XPMPMultiplayer.h
148
- inc/XPMPRemote.h
149
- inc/XPMPPlaneRenderer.h
150
- src/2D.h
151
- src/2D.cpp
152
- src/AIMultiplayer.h
153
- src/AIMultiplayer.cpp
154
- src/Aircraft.h
155
- src/Aircraft.cpp
156
- src/Contrail.cpp
157
- src/CSLCopy.cpp
158
- src/CSLModels.h
159
- src/CSLModels.cpp
160
- src/Map.h
161
- src/Map.cpp
162
- src/Network.h
163
- src/Network.cpp
164
- src/RelatedDoc8643.h
165
- src/RelatedDoc8643.cpp
166
- src/Remote.h
167
- src/Remote.cpp
168
- src/Sound.h
169
- src/Sound.cpp
170
- src/Utilities.h
171
- src/Utilities.cpp
172
- src/XPMP2.h
173
- src/XPMPMultiplayer.cpp
174
- )
175
-
176
173
# Define pre-compiled header
177
174
target_precompile_headers (XPMP2 PRIVATE src/XPMP2.h )
178
175
@@ -203,7 +200,7 @@ endif()
203
200
# (The actual FMOD lib is not included here, that needs to be done by the plugin target)
204
201
if (INCLUDE_FMOD_SOUND )
205
202
# Compile options
206
- add_compile_definitions ( INCLUDE_FMOD_SOUND=1 )
203
+ target_compile_definitions ( XPMP2 PRIVATE INCLUDE_FMOD_SOUND=1 )
207
204
target_sources (XPMP2 PRIVATE
208
205
src/SoundFMOD.h
209
206
src/SoundFMOD.cpp
0 commit comments