1 cmake_minimum_required(VERSION 3.19)
6 DESCRIPTION "Library for maritime navigation."
9 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
10 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
11 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
14 set(CMAKE_CXX_STANDARD 17)
15 set(CMAKE_CXX_STANDARD_REQUIRED ON)
16 set(CMAKE_CXX_EXTENSIONS OFF)
17 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
20 option(ENABLE_STATIC "Enable static library" ON)
21 option(ENABLE_PROFILING "Enable Profiling" OFF)
22 option(ENABLE_BENCHMARK "Enable Benchmark" OFF)
23 option(ENABLE_SANITIZER "Enable Sanitizing (address, undefined)" OFF)
24 option(ENABLE_EXAMPLES "Enable Examples" ON)
25 option(ENABLE_TESTS "Enable Tests" ON)
26 option(ENABLE_TESTS_BENCHMARK "Enable Test Benchmarks" ON)
27 option(ENABLE_TOOLS "Enable Tools" ON)
28 option(ENABLE_IWYU "Enable include-what-you-use" OFF)
30 if(NOT DEFINED BUILD_SHARED_LIBS)
32 set(BUILD_SHARED_LIBS FALSE)
34 set(BUILD_SHARED_LIBS TRUE)
39 set(BUILD_TESTING TRUE)
42 set(BUILD_TESTING FALSE)
46 include(RepoInformation)
47 include(Documentation)
52 set(CXXOPTS_BUILD_EXAMPLES FALSE CACHE BOOL "" FORCE)
53 set(CXXOPTS_BUILD_TESTS FALSE CACHE BOOL "" FORCE)
54 FetchContent_Declare(cxxopts
55 URL "${CMAKE_CURRENT_SOURCE_DIR}/extern/cxxopts"
57 FetchContent_MakeAvailable(cxxopts)
59 set(FMT_INSTALL TRUE CACHE BOOL "" FORCE)
60 FetchContent_Declare(fmt
61 URL "${CMAKE_CURRENT_SOURCE_DIR}/extern/fmt"
63 FetchContent_MakeAvailable(fmt)
67 message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
69 ${CMAKE_CURRENT_BINARY_DIR}/doc
70 ${CMAKE_CURRENT_BINARY_DIR}/doc/coverage
71 ${CMAKE_CURRENT_BINARY_DIR}/local/include
78 message(STATUS "Build Examples : ${ENABLE_EXAMPLES}")
80 add_subdirectory(examples)
84 message(STATUS "Build Tests : ${ENABLE_TESTS}")
85 message(STATUS "Build Tests Benchmark: ${ENABLE_TESTS_BENCHMARK}")
87 FetchContent_Declare(googletest
88 URL "${CMAKE_CURRENT_SOURCE_DIR}/extern/googletest-1.11.0"
90 FetchContent_MakeAvailable(googletest)
92 if(ENABLE_TESTS_BENCHMARK)
93 set(BENCHMARK_ENABLE_TESTING FALSE CACHE BOOL "" FORCE)
94 set(BENCHMARK_ENABLE_GTEST_TESTS FALSE CACHE BOOL "" FORCE)
95 FetchContent_Declare(benchmark
96 URL "${CMAKE_CURRENT_SOURCE_DIR}/extern/benchmark-1.6.0"
98 FetchContent_MakeAvailable(benchmark)
101 add_subdirectory(test)
105 if(CMAKE_BUILD_TYPE MATCHES Coverage)
106 include(CodeCoverage)
107 setup_target_for_coverage(coverage
113 set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
114 set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
115 set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
116 set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
117 set(CPACK_PACKAGE_NAME "marnav")
118 set(CPACK_PACKAGE_VENDOR "Mario Konrad")
119 set(CPACK_PACKAGE_CONTACT "Mario Konrad <mario.konrad@gmx.net>")
120 set(CPACK_PACAKGE_DESCRIPTION "Library for maritime navigation.")
121 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Library")
122 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
123 set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
124 set(CPACK_MONOLITHIC_INSTALL 1)
125 #set(CPACK_PACKAGE_EXECUTABLES "??" "??")
126 set(CPACK_STRIP_FILES true)
129 set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_DEBIAN_PACKAGE_NAME})
130 set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
131 set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACAKGE_DESCRIPTION})
132 set(CPACK_DEBIAN_PACKAGE_DEPENDS "libstdc++6 (>= 7.0)")
133 set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3)")
134 set(CPACK_DEBIAN_PACKAGE_SECTION "misc")
135 if (CMAKE_SIZEOF_VOID_P MATCHES "8")
136 set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
138 set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")