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
117 marnav/nmea/pgrme.cpp
118 marnav/nmea/pgrmm.cpp
119 marnav/nmea/pgrmz.cpp
125 marnav/nmea/route.cpp
130 marnav/nmea/sentence.cpp
132 marnav/nmea/split.cpp
133 marnav/nmea/stalk.cpp
135 marnav/nmea/string.cpp
136 marnav/nmea/tag_block.cpp
137 marnav/nmea/talker_id.cpp
156 marnav/nmea/waypoint.cpp
173 marnav/seatalk/message.cpp
174 marnav/seatalk/message_00.cpp
175 marnav/seatalk/message_01.cpp
176 marnav/seatalk/message_05.cpp
177 marnav/seatalk/message_10.cpp
178 marnav/seatalk/message_11.cpp
179 marnav/seatalk/message_20.cpp
180 marnav/seatalk/message_21.cpp
181 marnav/seatalk/message_22.cpp
182 marnav/seatalk/message_23.cpp
183 marnav/seatalk/message_24.cpp
184 marnav/seatalk/message_25.cpp
185 marnav/seatalk/message_26.cpp
186 marnav/seatalk/message_27.cpp
187 marnav/seatalk/message_30.cpp
188 marnav/seatalk/message_36.cpp
189 marnav/seatalk/message_38.cpp
190 marnav/seatalk/message_50.cpp
191 marnav/seatalk/message_51.cpp
192 marnav/seatalk/message_52.cpp
193 marnav/seatalk/message_53.cpp
194 marnav/seatalk/message_54.cpp
195 marnav/seatalk/message_56.cpp
196 marnav/seatalk/message_58.cpp
197 marnav/seatalk/message_59.cpp
198 marnav/seatalk/message_65.cpp
199 marnav/seatalk/message_66.cpp
200 marnav/seatalk/message_6c.cpp
201 marnav/seatalk/message_86.cpp
202 marnav/seatalk/message_87.cpp
203 marnav/seatalk/message_89.cpp
204 marnav/seatalk/seatalk.cpp
205 marnav/utils/mmsi.cpp
206 marnav/utils/mmsi_country.cpp
209 include(CheckSymbolExists)
211 check_symbol_exists(strtod_l xlocale.h HAVE_STRTOD_L)
213 check_symbol_exists(strtod_l stdlib.h HAVE_STRTOD_L)
216 if(DEFINED HAVE_STRTOD_L)
217 target_sources(marnav PRIVATE marnav/nmea/io_double_strtodl.cpp)
219 target_sources(marnav PRIVATE marnav/nmea/io_double_strstream.cpp)
224 ${PROJECT_SOURCE_DIR}/include/marnav/ais
225 ${PROJECT_SOURCE_DIR}/include/marnav/geo
226 ${PROJECT_SOURCE_DIR}/include/marnav/math
227 ${PROJECT_SOURCE_DIR}/include/marnav/nmea
228 ${PROJECT_SOURCE_DIR}/include/marnav/seatalk
229 ${PROJECT_SOURCE_DIR}/include/marnav/units
230 ${PROJECT_SOURCE_DIR}/include/marnav/utils
231 DESTINATION include/marnav
235 target_sources(marnav
238 marnav/io/nmea_reader.cpp
239 marnav/io/default_nmea_reader.cpp
240 marnav/io/seatalk_reader.cpp
241 marnav/io/default_seatalk_reader.cpp
244 DIRECTORY ${PROJECT_SOURCE_DIR}/include/marnav/io
245 DESTINATION include/marnav
249 target_include_directories(marnav
251 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
253 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
254 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
255 $<INSTALL_INTERFACE:include>
258 target_compile_options(marnav
269 -Wdisabled-optimization
277 -Wmissing-field-initializers
278 -Wmissing-format-attribute
279 -Wmissing-include-dirs
293 # explicitly disabled on purpose:
304 -Wno-format-nonliteral
310 target_compile_options(marnav
317 target_compile_options(marnav
319 -fno-omit-frame-pointer
324 message(STATUS "Sanitizer: enabled")
325 target_compile_options(marnav
331 target_link_libraries(marnav
337 if(CMAKE_BUILD_TYPE MATCHES Coverage)
338 message(STATUS "Coverage: enabled")
339 target_compile_options(marnav
345 -fno-inline-small-functions
350 set_target_properties(marnav
351 PROPERTIES VERSION "${PROJECT_VERSION}"
352 SOVERSION "${PROJECT_VERSION}"
355 # stuff for the config and config-version files
356 set(INCLUDE_INSTALL_DIR include)
357 set(LIB_INSTALL_DIR lib)
358 include(CMakePackageConfigHelpers)
360 set(targets_export_name ${PROJECT_NAME}-targets)
364 EXPORT ${targets_export_name}
365 LIBRARY DESTINATION ${LIB_INSTALL_DIR}
366 ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
367 RUNTIME DESTINATION bin
368 INCLUDES DESTINATION ${INCLUDE_INSTALL_DIR}
371 configure_package_config_file(
373 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
374 INSTALL_DESTINATION "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}"
375 PATH_VARS INCLUDE_INSTALL_DIR
379 EXPORT ${targets_export_name}
380 NAMESPACE "${PROJECT_NAME}::"
381 DESTINATION "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}"
384 write_basic_package_version_file(
385 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
386 VERSION "${PROJECT_VERSION}" COMPATIBILITY SameMajorVersion)
390 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
391 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
393 "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}"
399 add_executable(nmeasum)
400 target_sources(nmeasum PRIVATE nmeasum.cpp)
401 target_link_libraries(nmeasum PRIVATE marnav::marnav)
403 target_compile_options(nmeasum
414 add_executable(nmeadump)
415 target_sources(nmeadump PRIVATE nmeadump.cpp)
417 target_compile_options(nmeadump
426 target_link_libraries(nmeadump