-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
98 lines (72 loc) · 3.1 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#-----------------------------------------------------------------------------
#
# CMakeLists.txt
#
# Taginfo Tools
#
#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.10)
project(taginfo-tools VERSION 1.0.0)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 14)
#-----------------------------------------------------------------------------
#
# Set a default build type if none was specified
#
#-----------------------------------------------------------------------------
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
endif()
#-----------------------------------------------------------------------------
find_package(ICU REQUIRED COMPONENTS io uc)
find_package(Osmium 2.14.2 REQUIRED COMPONENTS io)
find_library(GD_LIBRARY NAMES gd)
find_library(SQLITE_LIBRARY NAMES sqlite3)
#-----------------------------------------------------------------------------
#
# Optional "clang-tidy" target
#
#-----------------------------------------------------------------------------
message(STATUS "Looking for clang-tidy")
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-20 clang-tidy-19 clang-tidy-18 clang-tidy-17 clang-tidy-16 clang-tidy-15)
if(CLANG_TIDY)
message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}")
file(GLOB _srcs RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/*.cpp" "${CMAKE_SOURCE_DIR}/test/*.cpp")
add_custom_target(clang-tidy
${CLANG_TIDY}
-p ${CMAKE_BINARY_DIR}
${_srcs}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src"
)
else()
message(STATUS "Looking for clang-tidy - not found")
message(STATUS " Build target 'clang-tidy' will not be available.")
endif()
#-----------------------------------------------------------------------------
#
# Version
#
#-----------------------------------------------------------------------------
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE VERSION_FROM_GIT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
set(VERSION_CPP ${PROJECT_BINARY_DIR}/src/version.cpp)
configure_file(
${PROJECT_SOURCE_DIR}/src/version.cpp.in
${VERSION_CPP}
)
#-----------------------------------------------------------------------------
option(ERROR_ON_WARNINGS "Generate error for compiler warnings" OFF)
set(WARNING_OPTIONS -Wall -Wextra -pedantic -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -Wold-style-cast CACHE STRING "Warning options")
add_subdirectory(abseil-cpp)
add_subdirectory(src)
enable_testing()
add_subdirectory(test)
#-----------------------------------------------------------------------------