aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorTink Team <tink-dev@google.com>2019-03-14 05:32:13 -0700
committerTink Team <noreply@google.com>2019-03-20 11:37:24 -0400
commita731c601d834754d693db446ce9924a8c547b278 (patch)
tree707cb330e28d83ce8e37cb386d60ecb738e8d762 /CMakeLists.txt
parent1bca47d7ec08823c73165a0cccd4fc1cb640a75f (diff)
downloadtink-a731c601d834754d693db446ce9924a8c547b278.tar.gz
Add initial CMake support to Tink.
PiperOrigin-RevId: 238424122 GitOrigin-RevId: e3850c2a7efb4b5ae1673260d681f53177943c2c
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt32
1 files changed, 32 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000000000..6072da016
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.5)
+project(Tink CXX)
+
+# Deviate from the naming convention for consistency with tink_version.bzl.
+include(tink_version.cmake)
+
+set(TINK_CXX_STANDARD 11)
+set(TINK_ENABLE_TESTS true)
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+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}/cc" "${TINK_INCLUDE_ALIAS_DIR}/tink")
+list(APPEND TINK_INCLUDE_DIRS "${TINK_INCLUDE_ALIAS_DIR}")
+
+add_subdirectory(cc)
+add_subdirectory(proto)