From f019077cd4dd779de42a9618234d9a5ff4d9d3e5 Mon Sep 17 00:00:00 2001
From: tholenst <tholenst@google.com>
Date: Mon, 17 Jun 2019 06:41:34 -0700
Subject: [PATCH] Run the unit tests with cmake under kokoro.

PiperOrigin-RevId: 253569428
---
 cc/CMakeLists.txt          |  2 +-
 cmake/TinkBuildRules.cmake |  2 ++
 kokoro/run_tests.sh        | 10 +++++++---
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/cc/CMakeLists.txt b/cc/CMakeLists.txt
index b74721846..6b5120a4e 100644
--- a/cc/CMakeLists.txt
+++ b/cc/CMakeLists.txt
@@ -612,7 +612,7 @@ tink_cc_test(
     tink::util::status
     tink::util::statusor
     tink::util::test_util
-    tink::util:test_matchers
+    tink::util::test_matchers
     tink::proto::aes_ctr_hmac_aead_cc_proto
     tink::proto::aes_gcm_cc_proto
     tink::proto::common_cc_proto
diff --git a/cmake/TinkBuildRules.cmake b/cmake/TinkBuildRules.cmake
index e2e824b78..1e1c00194 100644
--- a/cmake/TinkBuildRules.cmake
+++ b/cmake/TinkBuildRules.cmake
@@ -179,6 +179,8 @@ function(tink_cc_test)
 
   set_property(TARGET ${_target_name}
                PROPERTY FOLDER "${TINK_IDE_FOLDER}/Tests")
+  set_property(TARGET ${_target_name} PROPERTY CXX_STANDARD ${TINK_CXX_STANDARD})
+  set_property(TARGET ${_target_name} PROPERTY CXX_STANDARD_REQUIRED true)
 
   if (${CMAKE_VERSION} VERSION_LESS 3.9)
     add_test(NAME ${_target_name} COMMAND ${_target_name})
diff --git a/kokoro/run_tests.sh b/kokoro/run_tests.sh
index 19dad27ee..8ea46506b 100755
--- a/kokoro/run_tests.sh
+++ b/kokoro/run_tests.sh
@@ -123,10 +123,14 @@ run_macos_tests() {
 }
 
 run_cmake_tests() {
+  echo "========================================================= Running cmake"
   cmake --version
-  cmake .
-  make
-  echo "============ DONE TESTING WITH cmake ======="
+  cmake . -DTINK_BUILD_TESTS=ON
+  echo "==================================================== Building with make"
+  make -j8 all
+  echo "===================================================== Testing with make"
+  CTEST_OUTPUT_ON_FAILURE=1 make test
+  echo "================================================ Done testing with make"
 }
 
 run_linux_tests
-- 
GitLab