forked from swift-nav/libsbp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
42 lines (37 loc) · 1.19 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.2)
project(libsbp C)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" "${CMAKE_CURRENT_LIST_DIR}/cmake/common")
include(GNUInstallDirs)
include(CCache)
include(SwiftCmakeOptions)
swift_create_project_options(
HAS_TESTS
HAS_DOCS
TEST_PACKAGES "Check"
)
include(CodeCoverage)
include(TestTargets)
add_code_coverage_all_targets()
if(libsbp_BUILD_TESTS)
find_package(Googletest)
endif()
##########################################################
# Set some reasonable default compiler flags.
# Users of LibSbp that need different flags to be used can specify them
# when invoking cmake (cmake -DLIBSBP_CFLAGS:STRING="-Os -ffunction-sections")
# or by editing the CMakeCache.txt manually after invoking cmake
##########################################################
if(MSVC)
set(LIBSBP_CFLAGS "/Wall" CACHE STRING "Compile flags for libsbp.")
elseif(CMAKE_C_COMPILER_ID MATCHES "ARMCC")
# Warnings are on by default in armcc
else()
set(LIBSBP_CFLAGS "-Wall -Werror" CACHE STRING "Compile flags for libsbp.")
endif()
add_subdirectory(src)
if(libsbp_BUILD_DOCS)
add_subdirectory(docs)
endif()
if(libsbp_BUILD_TESTS)
add_subdirectory(test)
endif()