1 cmake_minimum_required(VERSION 3.11)
3 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
4 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
5 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
10 DESCRIPTION "Library for maritime navigation."
14 if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
15 message(STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID}")
17 message(FATAL_ERROR "Unsupported compiler detected: ${CMAKE_CXX_COMPILER_ID}")
21 set(CMAKE_CXX_STANDARD 11)
22 set(CMAKE_CXX_STANDARD_REQUIRED ON)
23 set(CMAKE_CXX_EXTENSIONS OFF)
24 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
27 option(ENABLE_STATIC "Enable static library" ON)
28 option(ENABLE_PROFILING "Enable Profiling" OFF)
29 option(ENABLE_BENCHMARK "Enable Benchmark" OFF)
30 option(ENABLE_SANITIZER "Enable Sanitizing (address, undefined)" OFF)
31 option(ENABLE_IO "Enable IO support" ON)
32 option(ENABLE_EXAMPLES "Enable Examples" ON)
33 option(ENABLE_TESTS "Enable Tests" ON)
34 option(ENABLE_TOOLS "Enable Tools" ON)
37 set(BUILD_SHARED_LIBS FALSE)
39 set(BUILD_SHARED_LIBS TRUE)
43 include(RepoInformation)
44 include(Documentation)
46 include(ExternalProject)
49 include(ExternCxxopts)
54 message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
56 ${CMAKE_CURRENT_BINARY_DIR}/doc
57 ${CMAKE_CURRENT_BINARY_DIR}/doc/coverage
58 ${CMAKE_CURRENT_BINARY_DIR}/local/include
65 message(STATUS "Build Examples: ${ENABLE_EXAMPLES}")
67 add_subdirectory(examples)
72 if(CTAGS_PATH AND CSCOPE_PATH)
73 setup_ctags_target("${CMAKE_CURRENT_SOURCE_DIR}/src/*.?pp;${CMAKE_CURRENT_SOURCE_DIR}/include/*.?pp")
77 message(STATUS "Build Tests: ${ENABLE_TESTS}")
80 include(ExternGoogletest)
81 include(ExternBenchmark)
82 add_subdirectory(test)
86 if(CMAKE_BUILD_TYPE MATCHES Coverage)
88 setup_target_for_coverage(coverage