-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
65 lines (56 loc) · 2.79 KB
/
Copy pathCMakeLists.txt
File metadata and controls
65 lines (56 loc) · 2.79 KB
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
cmake_minimum_required(VERSION 3.22)
project(Tink VERSION 2.8.0 LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(TINK_BUILD_TESTS "Build Tink tests" OFF)
option(TINK_USE_SYSTEM_OPENSSL "Build Tink linking to OpenSSL installed in the system" OFF)
option(TINK_USE_INSTALLED_ABSEIL "Build Tink linking to Abseil installed in the system" OFF)
option(TINK_USE_INSTALLED_GOOGLETEST "Build Tink linking to GTest installed in the system" OFF)
option(TINK_USE_INSTALLED_PROTOBUF "Build Tink linking to Protobuf installed in the system" OFF)
option(TINK_USE_INSTALLED_BENCHMARK "Build Tink linking to benchmark installed in the system" OFF)
option(USE_ONLY_FIPS "Enables the FIPS only mode in Tink" OFF)
set(CPACK_GENERATOR TGZ)
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
# For MSCV, force the static runtime.
# Currently, both absl and cmake allow to override this. In order to make things
# more likely to be built correctly we currently only allow static runtimes.
# We need to do this before "include(TinkWorkspace)" since we need to do it
# before loading absl/proto.
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(ABSL_MSVC_STATIC_RUNTIME ON)
set(protobuf_MSVC_STATIC_RUNTIME ON)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
endif()
if (TINK_BUILD_TESTS)
# We do not want to test Abseil
set(ABSL_BUILD_TESTING OFF CACHE BOOL "" FORCE)
# We do build the Abseil test helpers though -- we use them.
set(ABSL_BUILD_TEST_HELPERS ON CACHE BOOL "" FORCE)
# Tink needs Googletest, so Abseil is never responsible for installing it.
set(ABSL_USE_EXTERNAL_GOOGLETEST ON CACHE BOOL "" FORCE)
# If Tink uses an installed GTest, Abseil should use that one too.
if (TINK_USE_INSTALLED_GOOGLETEST)
set(ABSL_FIND_GOOGLETEST ON CACHE BOOL "" FORCE)
else()
set(ABSL_FIND_GOOGLETEST OFF CACHE BOOL "" FORCE)
endif()
endif()
include(CPack)
include(TinkWorkspace)
include(TinkBuildRules)
include(TinkUtil)
# Bazel rewrites import paths so that "cc/example/foo.h" can be included as
# "tink/example/foo.h". The following lines simulate this behaviour by creating
# a symlink to cc/ called tink/, and placing it in a separate subdirectory,
# which is then specified as a global include path.
#
# It's important to create a separate directory and not just drop the link in
# CMAKE_CURRENT_BINARY_DIR, since adding that to the include paths will
# make the whole contents of that directory visible to the compiled files,
# which may result in undeclared dependencies that nevertheless happen to work.
#
set(TINK_INCLUDE_ALIAS_DIR "${CMAKE_CURRENT_BINARY_DIR}/__include_alias")
add_directory_alias(
"${CMAKE_CURRENT_SOURCE_DIR}/tink" "${TINK_INCLUDE_ALIAS_DIR}/tink")
list(APPEND TINK_INCLUDE_DIRS "${TINK_INCLUDE_ALIAS_DIR}")
add_subdirectory(tink)
add_subdirectory(proto)