1 cmake_minimum_required(VERSION 3.11)
5 message(STATUS "Build shared library : ${BUILD_SHARED_LIBS}")
6 message(STATUS "Build IO support : ${ENABLE_IO}")
7 message(STATUS "Build Tools : ${ENABLE_TOOLS}")
10 ${CMAKE_CURRENT_SOURCE_DIR}/marnav/version.hpp.in
11 ${CMAKE_CURRENT_BINARY_DIR}/marnav/version.hpp
15 FILES ${CMAKE_CURRENT_BINARY_DIR}/marnav/version.hpp
16 DESTINATION include/marnav
19 add_library(marnav ${LIBRARY_TYPE})
20 add_library(marnav::marnav ALIAS marnav)
22 target_compile_features(marnav
31 marnav/ais/binary_001_11.cpp
32 marnav/ais/binary_200_10.cpp
33 marnav/ais/binary_data.cpp
34 marnav/ais/message_01.cpp
35 marnav/ais/message_02.cpp
36 marnav/ais/message_03.cpp
37 marnav/ais/message_04.cpp
38 marnav/ais/message_05.cpp
39 marnav/ais/message_06.cpp
40 marnav/ais/message_07.cpp
41 marnav/ais/message_08.cpp
42 marnav/ais/message_09.cpp
43 marnav/ais/message_10.cpp
44 marnav/ais/message_11.cpp
45 marnav/ais/message_12.cpp
46 marnav/ais/message_13.cpp
47 marnav/ais/message_14.cpp
48 marnav/ais/message_17.cpp
49 marnav/ais/message_18.cpp
50 marnav/ais/message_19.cpp
51 marnav/ais/message_20.cpp
52 marnav/ais/message_21.cpp
53 marnav/ais/message_22.cpp
54 marnav/ais/message_23.cpp
55 marnav/ais/message_24.cpp
57 marnav/ais/rate_of_turn.cpp
58 marnav/ais/vessel_dimension.cpp
61 marnav/geo/geodesic.cpp
62 marnav/geo/position.cpp
65 marnav/nmea/ais_helper.cpp
75 marnav/nmea/checks.cpp
76 marnav/nmea/checksum.cpp
77 marnav/nmea/convert.cpp
81 marnav/nmea/detail.cpp
100 marnav/nmea/hex_digit.hpp
106 marnav/nmea/manufacturer.cpp
116 marnav/nmea/pgrme.cpp
117 marnav/nmea/pgrmm.cpp
118 marnav/nmea/pgrmz.cpp
128 marnav/nmea/sentence.cpp
130 marnav/nmea/split.cpp
131 marnav/nmea/stalk.cpp
133 marnav/nmea/string.cpp
134 marnav/nmea/tag_block.cpp
135 marnav/nmea/talker_id.cpp
153 marnav/nmea/waypoint.cpp
164 marnav/seatalk/message.cpp
165 marnav/seatalk/message_00.cpp
166 marnav/seatalk/message_01.cpp
167 marnav/seatalk/message_05.cpp
168 marnav/seatalk/message_10.cpp
169 marnav/seatalk/message_11.cpp
170 marnav/seatalk/message_20.cpp
171 marnav/seatalk/message_21.cpp
172 marnav/seatalk/message_22.cpp
173 marnav/seatalk/message_23.cpp
174 marnav/seatalk/message_24.cpp
175 marnav/seatalk/message_25.cpp
176 marnav/seatalk/message_26.cpp
177 marnav/seatalk/message_27.cpp
178 marnav/seatalk/message_30.cpp
179 marnav/seatalk/message_36.cpp
180 marnav/seatalk/message_38.cpp
181 marnav/seatalk/message_50.cpp
182 marnav/seatalk/message_51.cpp
183 marnav/seatalk/message_52.cpp
184 marnav/seatalk/message_53.cpp
185 marnav/seatalk/message_54.cpp
186 marnav/seatalk/message_56.cpp
187 marnav/seatalk/message_58.cpp
188 marnav/seatalk/message_59.cpp
189 marnav/seatalk/message_65.cpp
190 marnav/seatalk/message_66.cpp
191 marnav/seatalk/message_6c.cpp
192 marnav/seatalk/message_86.cpp
193 marnav/seatalk/message_87.cpp
194 marnav/seatalk/message_89.cpp
195 marnav/seatalk/seatalk.cpp
196 marnav/utils/mmsi.cpp
197 marnav/utils/mmsi_country.cpp
200 include(CheckSymbolExists)
202 check_symbol_exists(strtod_l xlocale.h HAVE_STRTOD_L)
204 check_symbol_exists(strtod_l stdlib.h HAVE_STRTOD_L)
207 if(DEFINED HAVE_STRTOD_L)
208 target_sources(marnav PRIVATE marnav/nmea/io_double_strtodl.cpp)
210 target_sources(marnav PRIVATE marnav/nmea/io_double_strstream.cpp)
215 ${PROJECT_SOURCE_DIR}/include/marnav/ais
216 ${PROJECT_SOURCE_DIR}/include/marnav/geo
217 ${PROJECT_SOURCE_DIR}/include/marnav/math
218 ${PROJECT_SOURCE_DIR}/include/marnav/nmea
219 ${PROJECT_SOURCE_DIR}/include/marnav/seatalk
220 ${PROJECT_SOURCE_DIR}/include/marnav/units
221 ${PROJECT_SOURCE_DIR}/include/marnav/utils
222 DESTINATION include/marnav
226 target_sources(marnav
229 marnav/io/nmea_reader.cpp
230 marnav/io/default_nmea_reader.cpp
231 marnav/io/seatalk_reader.cpp
232 marnav/io/default_seatalk_reader.cpp
235 DIRECTORY ${PROJECT_SOURCE_DIR}/include/marnav/io
236 DESTINATION include/marnav
240 target_include_directories(marnav
242 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
244 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
245 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
246 $<INSTALL_INTERFACE:include>
249 target_compile_options(marnav
260 -Wdisabled-optimization
267 -Wmissing-field-initializers
268 -Wmissing-format-attribute
269 -Wmissing-include-dirs
283 # explicitly disabled on purpose:
294 -Wno-format-nonliteral
300 target_compile_options(marnav
307 target_compile_options(marnav
309 -fno-omit-frame-pointer
314 message(STATUS "Sanitizer: enabled")
315 target_compile_options(marnav
321 target_link_libraries(marnav
327 if(CMAKE_BUILD_TYPE MATCHES Coverage)
328 message(STATUS "Coverage: enabled")
329 target_compile_options(marnav
335 -fno-inline-small-functions
340 set_target_properties(marnav
341 PROPERTIES VERSION "${PROJECT_VERSION}"
342 SOVERSION "${PROJECT_VERSION}"
345 # stuff for the config and config-version files
346 set(INCLUDE_INSTALL_DIR include)
347 set(LIB_INSTALL_DIR lib)
348 include(CMakePackageConfigHelpers)
350 set(targets_export_name ${PROJECT_NAME}-targets)
354 EXPORT ${targets_export_name}
355 LIBRARY DESTINATION ${LIB_INSTALL_DIR}
356 ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
357 RUNTIME DESTINATION bin
358 INCLUDES DESTINATION ${INCLUDE_INSTALL_DIR}
361 configure_package_config_file(
363 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
364 INSTALL_DESTINATION "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}"
365 PATH_VARS INCLUDE_INSTALL_DIR
369 EXPORT ${targets_export_name}
370 NAMESPACE "${PROJECT_NAME}::"
371 DESTINATION "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}"
374 write_basic_package_version_file(
375 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
376 VERSION "${PROJECT_VERSION}" COMPATIBILITY SameMajorVersion)
380 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
381 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
383 "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}"
389 add_executable(nmeasum)
390 target_sources(nmeasum PRIVATE nmeasum.cpp)
391 target_link_libraries(nmeasum PRIVATE marnav::marnav)
393 target_compile_options(nmeasum
404 add_executable(nmeadump)
405 target_sources(nmeadump PRIVATE nmeadump.cpp)
407 target_compile_options(nmeadump
416 target_link_libraries(nmeadump