-
Notifications
You must be signed in to change notification settings - Fork 128
/
CMakeLists.txt
135 lines (114 loc) · 3.58 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
cmake_minimum_required(VERSION 3.5)
project(entwine)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
set(ENTWINE_VERSION_MAJOR 3 CACHE STRING "Entwine major version" FORCE)
set(ENTWINE_VERSION_MINOR 1 CACHE STRING "Entwine minor version" FORCE)
set(ENTWINE_VERSION_PATCH 0 CACHE STRING "Entwine patch version" FORCE)
set(ENTWINE_VERSION_STRING
"${ENTWINE_VERSION_MAJOR}.${ENTWINE_VERSION_MINOR}.${ENTWINE_VERSION_PATCH}"
CACHE STRING "Entwine version string" FORCE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(ENTWINE_API_VERSION "3")
set(ENTWINE_BUILD_VERSION ${ENTWINE_VERSION_STRING})
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
MESSAGE("Defaulting to release mode")
set(CMAKE_BUILD_TYPE "Release")
endif()
include(FeatureSummary)
set(ROOT_DIR ${PROJECT_SOURCE_DIR})
set(CMAKE_DIR ${ROOT_DIR}/cmake)
link_directories(${ADDITIONAL_LINK_DIRECTORIES_PATHS})
set(entwine_defs_hpp_in
"${ROOT_DIR}/entwine/types/defs.hpp.in")
set(entwine_defs_hpp
${PROJECT_BINARY_DIR}/include/entwine/types/defs.hpp)
configure_file(${entwine_defs_hpp_in} ${entwine_defs_hpp})
option(WITH_ZSTD
"Build support for compression/decompression with Zstd." TRUE)
if (NOT WITH_ZSTD)
add_definitions(-DNO_ZSTD)
endif()
include(${CMAKE_DIR}/threads.cmake)
include(${CMAKE_DIR}/backtrace.cmake)
include(${CMAKE_DIR}/curl.cmake)
include(${CMAKE_DIR}/openssl.cmake)
include(${CMAKE_DIR}/pdal.cmake)
#
# Must come last. Depends on vars set in other include files.
#
include(${CMAKE_DIR}/system.cmake)
set(THIRD_ROOT $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/entwine/third>)
include_directories(SYSTEM PUBLIC ${THIRD_ROOT})
add_subdirectory(entwine)
add_subdirectory(app)
#
# Each subdirectory is built as an object library, which is a collection
# of files which act as a target. No actual file is built.
#
set(OBJS
$<TARGET_OBJECTS:io>
$<TARGET_OBJECTS:third>
$<TARGET_OBJECTS:builder>
$<TARGET_OBJECTS:types>
$<TARGET_OBJECTS:util>
)
if (MSVC)
add_library(entwine STATIC ${OBJS})
target_link_libraries(entwine PRIVATE wsock32 ws2_32)
else()
add_library(entwine SHARED ${OBJS})
endif()
target_link_libraries(entwine
PUBLIC
${LZMA_LIBRARY}
${CMAKE_DL_LIBS}
PRIVATE
pdalcpp
${CURL_LIBRARIES}
${OPENSSL_LIBRARIES}
${SHLWAPI}
)
set_target_properties(
entwine
PROPERTIES
VERSION ${ENTWINE_BUILD_VERSION}
SOVERSION ${ENTWINE_API_VERSION}
CLEAN_DIRECT_OUTPUT 1)
#
# Test
#
option(WITH_TESTS "Choose if Entwine unit tests should be built" TRUE)
if (WITH_TESTS)
message("Configuring with unit tests")
enable_testing()
set(GOOGLETEST_VERSION 1.13.0)
add_subdirectory("${PROJECT_SOURCE_DIR}/test/googletest-1.13.0/googletest")
add_subdirectory(test)
else()
message("Configuring with NO unit tests")
endif()
#
# Installation
#
install(TARGETS entwine DESTINATION lib EXPORT entwine-targets)
install(FILES ${entwine_defs_hpp} DESTINATION "include/entwine/types")
#export(
# EXPORT entwine-targets
# FILE "${PROJECT_BINARY_DIR}/entwine-targets.cmake")
configure_file(
cmake/entwine-config.cmake.in "${PROJECT_BINARY_DIR}/entwine-config.cmake"
@ONLY)
install(
EXPORT entwine-targets
FILE entwine-targets.cmake
NAMESPACE Entwine:: DESTINATION lib/cmake/entwine)
install(
FILES "${PROJECT_BINARY_DIR}/entwine-config.cmake"
DESTINATION lib/cmake/entwine)
#
# Cpack
#
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpack.cmake")
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES)