diff options
author | Benjamin Barenblat <bbaren@google.com> | 2020-05-19 11:55:11 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2020-05-19 11:55:11 -0400 |
commit | acf588f5a22eafd7d21de55b954e8641d4b06568 (patch) | |
tree | ee689a9ef34982825e511f997f7b5b9ccb3d2b08 /debian/tests | |
parent | f9adb234861d1321e0b8774db9aed57ebc6161f0 (diff) | |
download | abseil-acf588f5a22eafd7d21de55b954e8641d4b06568.tar.gz abseil-acf588f5a22eafd7d21de55b954e8641d4b06568.tar.bz2 abseil-acf588f5a22eafd7d21de55b954e8641d4b06568.zip |
Enable CMake support
Install Abseil’s CMake support files. Some of these files are
autogenerated, and the generator produces files with a googletest
dependency if Abseil is built with unit tests enabled; to prevent this,
turn off unit tests.
Diffstat (limited to 'debian/tests')
-rwxr-xr-x | debian/tests/cmake | 45 | ||||
-rw-r--r-- | debian/tests/control | 3 |
2 files changed, 48 insertions, 0 deletions
diff --git a/debian/tests/cmake b/debian/tests/cmake new file mode 100755 index 00000000..1eb04de9 --- /dev/null +++ b/debian/tests/cmake @@ -0,0 +1,45 @@ +#!/bin/sh -eu +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +readonly TMP="$(mktemp -d)" +trap "rm -rf \"$TMP\"" EXIT +cd "$TMP" + +cat >test.cc <<EOF +#include <absl/strings/numbers.h> + +int main(int argc, char* argv[]) { + int n; + if (!absl::SimpleAtoi(argv[1], &n)) { + return 1; + } + return n; +} +EOF + +cat >CMakeLists.txt <<EOF +cmake_minimum_required(VERSION 3.5) +project(test CXX) +set(CMAKE_CXX_STANDARD 14) +add_executable(test test.cc) +find_package(absl REQUIRED) +target_link_libraries(test absl::strings) +EOF + +mkdir build +cd build +cmake .. +make +./test 0 diff --git a/debian/tests/control b/debian/tests/control index fbbf5129..43dc87cb 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -14,3 +14,6 @@ Tests: smoke Depends: @, g++, libgtest-dev + +Tests: cmake +Depends: @, cmake (>= 3.5), g++, make |