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