File: modify_cmake_for_debian

package info (click to toggle)
flightcrew 0.9.3%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 6,768 kB
  • sloc: cpp: 53,736; xml: 2,006; ansic: 275; python: 215; sh: 112; exp: 8; makefile: 7
file content (256 lines) | stat: -rw-r--r-- 9,447 bytes parent folder | download
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
Description: Modify CmakeLists for Debian
 Avoid using the boundled libraries but link the system ones.
Author: Don Armstrong <don@debian.org>
Author: Mattia Rizzolo <mattia@mapreri.org>
Author: Francois Mazen <francois@mzf.fr>
Forwarded: not-needed
Last-Update: 2018-05-02



--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,6 @@
 
 # The parsing order is significant!
 
-add_subdirectory( src/BoostParts )
 # Set these so zipios doesn't complain.
 set( Boost_DATE_TIME_LIBRARY 1 )
 set( Boost_FILESYSTEM_LIBRARY 1 )
@@ -51,21 +50,14 @@
 set( Boost_SYSTEM_LIBRARY 1 )
 set( Boost_THREAD_LIBRARY 1 )
 set( BOOST_LIBS BoostParts )
-set( BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/BoostParts )
 
-add_subdirectory( src/Xerces )
 set( XERCES_LIBRARIES Xerces )
-set( XERCES_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/Xerces )
 
 add_subdirectory( src/XercesExtensions )
 set( XERCESEXTENSIONS_LIBRARIES XercesExtensions )
 set( XERCESEXTENSIONS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/XercesExtensions )
 
-add_subdirectory( src/zlib )
 add_subdirectory( src/zipios )
-if( NOT MINGW )
-    add_subdirectory( src/googlemock )
-endif()
 
 add_subdirectory( src/FlightCrew )
 set( FLIGHTCREW_LIBRARIES FlightCrew )
--- a/src/FlightCrew-cli/CMakeLists.txt
+++ b/src/FlightCrew-cli/CMakeLists.txt
@@ -63,6 +63,7 @@
 # "Print all warnings" flag for GCC
 elseif( CMAKE_COMPILER_IS_GNUCXX )
     add_definitions( -Wall )
+    set_target_properties( ${PROJECT_NAME} PROPERTIES LINK_FLAGS -Wl,--as-needed )
 endif()
 
 set_source_files_properties( main.cpp PROPERTIES COMPILE_DEFINITIONS FLIGHTCREW_FULL_VERSION="${FLIGHTCREW_FULL_VERSION}" )
--- a/src/FlightCrew/CMakeLists.txt
+++ b/src/FlightCrew/CMakeLists.txt
@@ -52,9 +52,7 @@
 
 # creating PCH's for MSVC and GCC on Linux
 include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake )
-set( ALL_INCLUDES ${BoostParts_SOURCE_DIR}
-                  ${Xerces_SOURCE_DIR}
-                  ${zipios_SOURCE_DIR} )
+set( ALL_INCLUDES ${zipios_SOURCE_DIR} )
 set( GCC_PCH_TARGET gccPCH_fc )
 
 if( NOT SKIP_PCH )
@@ -67,8 +65,6 @@
 # and the headers for the linked-to libraries
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
                      ../zipios
-                     ../BoostParts 
-                     ../Xerces
                      ../XercesExtensions
                      ../utf8-cpp
                    )
@@ -85,11 +81,29 @@
     # when they want a dll, but NOT FC_DLL_EXPORTING
     add_definitions( -DFC_DLL_EXPORTING -DFC_BUILT_AS_DLL )
     add_library( ${PROJECT_NAME} SHARED ${SOURCES} )
+    SET_TARGET_PROPERTIES(
+      ${PROJECT_NAME}
+      PROPERTIES
+      SOVERSION 0
+      VERSION 0.9.3
+      )
 else()
     add_library( ${PROJECT_NAME} STATIC ${SOURCES} )
 endif()
 
-target_link_libraries( ${PROJECT_NAME} zipios BoostParts XercesExtensions )
+find_library(LIB_ZLIB z)
+find_library(BOOST_DT boost_date_time)
+find_library(BOOST_FS boost_filesystem)
+find_library(BOOST_PO boost_program_options)
+find_library(BOOST_RE boost_regex)
+find_library(BOOST_S boost_system)
+find_library(BOOST_T boost_thread)
+find_library(LIB_XERCES xerces-c)
+find_library(PTHREAD pthread)
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINK_FLAGS -Wl,--as-needed)
+target_link_libraries( ${PROJECT_NAME} ${LIB_ZLIB} ${BOOST_DT} ${BOOST_FS} ${BOOST_PO} ${BOOST_RE} ${BOOST_S} ${BOOST_T} zipios ${LIB_XERCES} XercesExtensions ${PTHREAD} )
+INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib COMPONENT libraries)
+INSTALL(FILES flightcrew.h exception.h DllExporting.h Result.h Misc/ErrorResultCollector.h ResultId.h ResultType.h ../XercesExtensions/NodeLocationInfo.h DESTINATION include/${PROJECT_NAME})
 
 #############################################################################
 
@@ -126,8 +140,6 @@
 	endif()
 endif()
 
-# needed for correct Xerces header inclusion
-add_definitions( -DXERCES_STATIC_LIBRARY )
 
 #############################################################################
 
--- a/src/FlightCrew-gui/CMakeLists.txt
+++ b/src/FlightCrew-gui/CMakeLists.txt
@@ -82,7 +82,6 @@
 include_directories( BEFORE
                      ${CMAKE_CURRENT_SOURCE_DIR}
                      ${CMAKE_CURRENT_BINARY_DIR}
-                     ${BoostParts_SOURCE_DIR}
                      ${FlightCrew_SOURCE_DIR}
                      ${XercesExtensions_SOURCE_DIR}
                      )
@@ -134,6 +133,7 @@
 # "Print all warnings" flag for GCC
 elseif( CMAKE_COMPILER_IS_GNUCXX )
     add_definitions( -Wall )
+    set_target_properties( ${PROJECT_NAME} PROPERTIES LINK_FLAGS -Wl,--as-needed )
 endif()
 
 set_source_files_properties( MainWindow.cpp PROPERTIES COMPILE_DEFINITIONS FLIGHTCREW_FULL_VERSION="${FLIGHTCREW_FULL_VERSION}" )
@@ -159,6 +159,10 @@
                         WORKING_DIRECTORY ${WORK_DIR}
                         DEPENDS addframeworks )
                 
+elseif(DEBIAN)
+        # these rules are so that we don't do any crazy installer
+        #  building which we've stripped out anyway
+        set( WORK_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" )
 # For Linux and Windows, provide binary installers.
 # For this to work on Linux, InstallJammer needs to be installed and on the system path.
 # For this to work on Windows, Inno Setup's iscc compiler needs to be installed and on the system path.
--- a/src/FlightCrew/tests/CMakeLists.txt
+++ b/src/FlightCrew/tests/CMakeLists.txt
@@ -41,12 +41,12 @@
 # That means that subdirs inherit the include_directories of their parents.
 # So techincally we don't need to include Xerces etc.
 include_directories( ${CMAKE_CURRENT_BINARY_DIR} 
-                     ${CMAKE_CURRENT_SOURCE_DIR} 
-                     ../../BoostParts 
-                     ../../Xerces 
                      ../../XercesExtensions 
-                     ../../googlemock/include
-                     ../../googlemock/gtest/include
+                     /usr/src/googletest/googlemock/include
+                     /usr/src/googletest/googlemock
+                     /usr/src/googletest/googletest/include
+                     /usr/src/googletest/googletest
+                     ${CMAKE_CURRENT_SOURCE_DIR}
                    )
 
 link_directories ( ${PROJECT_BINARY_DIR}/lib ) 
@@ -55,7 +55,7 @@
 
 # creating PCH's for MSVC and GCC on Linux
 include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake )
-set( ALL_INCLUDES ${gtest_SOURCE_DIR}/include ${BoostParts_SOURCE_DIR} )
+set( ALL_INCLUDES /usr/src/googletest/googletest/include ${BoostParts_SOURCE_DIR} )
 
 set( GCC_PCH_TARGET gccPCH_tests )
 
@@ -65,7 +65,12 @@
 
 add_executable( ${PROJECT_NAME} ${TEST_SOURCES} )
 
-target_link_libraries( ${PROJECT_NAME} FlightCrew gmock )
+add_library( GOOGLE_MOCK_LIB STATIC
+    /usr/src/googletest/googlemock/src/gmock-all.cc
+    /usr/src/googletest/googletest/src/gtest-all.cc
+)
+
+target_link_libraries( ${PROJECT_NAME} FlightCrew GOOGLE_MOCK_LIB )
 
 #############################################################################
 
@@ -100,9 +105,6 @@
     add_dependencies( ${PROJECT_NAME} ${GCC_PCH_TARGET} )
 endif()
 
-# needed for correct Xerces header inclusion
-add_definitions( -DXERCES_STATIC_LIBRARY )
-
 #############################################################################
 
 # The test executable expects a "test_data" dir in its working directory.
--- a/src/XercesExtensions/CMakeLists.txt
+++ b/src/XercesExtensions/CMakeLists.txt
@@ -15,15 +15,14 @@
 
 # We need to pick up the stdafx.h file
 # and the headers for the linked-to libraries
-include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
-                     ${XERCES_INCLUDE_DIRS}
-                     ${BOOST_INCLUDE_DIRS} )
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR})
 
 link_directories ( ${PROJECT_BINARY_DIR}/lib ) 
 
 add_library( ${PROJECT_NAME} STATIC ${SOURCES} )
 
-target_link_libraries( ${PROJECT_NAME} ${XERCES_LIBRARIES} )
+find_library(LIB_XERCES xerces-c)
+target_link_libraries( ${PROJECT_NAME} ${LIB_XERCES} )
 
 #############################################################################
 
@@ -45,11 +44,7 @@
 
 # "Print all warnings" flag for GCC
 elseif( CMAKE_COMPILER_IS_GNUCXX )
+    SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS -fPIC)
     add_definitions( -Wall )
 endif()
 
-# needed for correct Xerces header inclusion
-if( FORCE_BUNDLED_COPIES OR NOT XERCES_FOUND)
-    add_definitions( -DXERCES_STATIC_LIBRARY )
-endif()
-
--- a/src/zipios/CMakeLists.txt
+++ b/src/zipios/CMakeLists.txt
@@ -25,7 +25,14 @@
 
 add_library( ${PROJECT_NAME} STATIC ${SOURCES} )
 
-target_link_libraries( ${PROJECT_NAME} zlib BoostParts )
+find_library(LIB_ZLIB z)
+find_library(BOOST_DT boost_date_time)
+find_library(BOOST_FS boost_filesystem)
+find_library(BOOST_PO boost_program_options)
+find_library(BOOST_RE boost_regex)
+find_library(BOOST_S boost_system)
+find_library(BOOST_T boost_thread)
+target_link_libraries( ${PROJECT_NAME} ${LIB_ZLIB} ${BOOST_DT} ${BOOST_FS} ${BOOST_PO} ${BOOST_RE} ${BOOST_S} ${BOOST_T})
 
 #############################################################################
 
@@ -44,6 +51,7 @@
 
 # "Print all warnings" flag for GCC
 elseif( CMAKE_COMPILER_IS_GNUCXX )
+    SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS -fPIC)
     add_definitions( -Wall )
 endif()