xref: /aosp_15_r20/external/tink/CMakeLists.txt (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1cmake_minimum_required(VERSION 3.13)
2project(Tink VERSION 2.0.0 LANGUAGES CXX)
3
4list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
5
6option(TINK_BUILD_TESTS "Build Tink tests" OFF)
7option(TINK_USE_SYSTEM_OPENSSL "Build Tink linking to OpenSSL installed in the system" OFF)
8option(TINK_USE_INSTALLED_ABSEIL "Build Tink linking to Abseil installed in the system" OFF)
9option(TINK_USE_INSTALLED_GOOGLETEST "Build Tink linking to GTest installed in the system" OFF)
10option(USE_ONLY_FIPS "Enables the FIPS only mode in Tink" OFF)
11
12set(CPACK_GENERATOR TGZ)
13set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
14
15include(CPack)
16include(TinkWorkspace)
17include(TinkBuildRules)
18include(TinkUtil)
19
20# Bazel rewrites import paths so that "cc/example/foo.h" can be included as
21# "tink/example/foo.h". The following lines simulate this behaviour by creating
22# a symlink to cc/ called tink/, and placing it in a separate subdirectory,
23# which is then specified as a global include path.
24#
25# It's important to create a separate directory and not just drop the link in
26# CMAKE_CURRENT_BINARY_DIR, since adding that to the include paths will
27# make the whole contents of that directory visible to the compiled files,
28# which may result in undeclared dependencies that nevertheless happen to work.
29#
30set(TINK_INCLUDE_ALIAS_DIR "${CMAKE_CURRENT_BINARY_DIR}/__include_alias")
31add_directory_alias(
32  "${CMAKE_CURRENT_SOURCE_DIR}/cc" "${TINK_INCLUDE_ALIAS_DIR}/tink")
33list(APPEND TINK_INCLUDE_DIRS "${TINK_INCLUDE_ALIAS_DIR}")
34
35add_subdirectory(cc)
36add_subdirectory(proto)
37