Merge pull request #8 from adevress/master

Add CMake support
This commit is contained in:
Gennadiy Civil 2017-11-06 12:56:37 -08:00 committed by GitHub
commit 78e1abca86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 1892 additions and 0 deletions

156
CMake/AbseilHelpers.cmake Normal file
View file

@ -0,0 +1,156 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
include(CMakeParseArguments)
#
# create a library in the absl namespace
#
# parameters
# SOURCES : sources files for the library
# PUBLIC_LIBRARIES: targets and flags for linking phase
# PRIVATE_COMPILE_FLAGS: compile flags for the library. Will not be exported.
# EXPORT_NAME: export name for the absl:: target export
# TARGET: target name
#
# create a target associated to <NAME>
# libraries are installed under CMAKE_INSTALL_FULL_LIBDIR by default
#
function(absl_library)
cmake_parse_arguments(ABSL_LIB
"DISABLE_INSTALL" # keep that in case we want to support installation one day
"TARGET;EXPORT_NAME"
"SOURCES;PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS;PUBLIC_INCLUDE_DIRS;PRIVATE_INCLUDE_DIRS"
${ARGN}
)
set(_NAME ${ABSL_LIB_TARGET})
string(TOUPPER ${_NAME} _UPPER_NAME)
add_library(${_NAME} STATIC ${ABSL_LIB_SOURCES})
target_compile_options(${_NAME} PRIVATE ${ABSL_COMPILE_CXXFLAGS} ${ABSL_LIB_PRIVATE_COMPILE_FLAGS})
target_link_libraries(${_NAME} PUBLIC ${ABSL_LIB_PUBLIC_LIBRARIES})
target_include_directories(${_NAME}
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_LIB_PUBLIC_INCLUDE_DIRS}
PRIVATE ${ABSL_LIB_PRIVATE_INCLUDE_DIRS}
)
if(ABSL_LIB_EXPORT_NAME)
add_library(absl::${ABSL_LIB_EXPORT_NAME} ALIAS ${_NAME})
endif()
endfunction()
#
# header only virtual target creation
#
function(absl_header_library)
cmake_parse_arguments(ABSL_HO_LIB
"DISABLE_INSTALL"
"EXPORT_NAME;TARGET"
"PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS;PUBLIC_INCLUDE_DIRS;PRIVATE_INCLUDE_DIRS"
${ARGN}
)
set(_NAME ${ABSL_HO_LIB_TARGET})
set(__dummy_header_only_lib_file "${CMAKE_CURRENT_BINARY_DIR}/${_NAME}_header_only_dummy.cc")
if(NOT EXISTS ${__dummy_header_only_lib_file})
file(WRITE ${__dummy_header_only_lib_file}
"\
/* generated file for header-only cmake target */ \
\
// single meaningless symbol \
void __${_NAME}__header_fakesym() {} \
\
"
)
endif()
add_library(${_NAME} ${__dummy_header_only_lib_file})
target_link_libraries(${_NAME} PUBLIC ${ABSL_HO_LIB_PUBLIC_LIBRARIES})
target_include_directories(${_NAME}
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_HO_LIB_PUBLIC_INCLUDE_DIRS}
PRIVATE ${ABSL_HO_LIB_PRIVATE_INCLUDE_DIRS}
)
if(ABSL_HO_LIB_EXPORT_NAME)
add_library(absl::${ABSL_HO_LIB_EXPORT_NAME} ALIAS ${_NAME})
endif()
endfunction()
#
# create an abseil unit_test and add it to the executed test list
#
# parameters
# TARGET: target name prefix
# SOURCES: sources files for the tests
# PUBLIC_LIBRARIES: targets and flags for linking phase.
# PRIVATE_COMPILE_FLAGS: compile flags for the test. Will not be exported.
#
# create a target associated to <NAME>_bin
#
# all tests will be register for execution with add_test()
#
# test compilation and execution is disable when BUILD_TESTING=OFF
#
function(absl_test)
cmake_parse_arguments(ABSL_TEST
""
"TARGET"
"SOURCES;PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS;PUBLIC_INCLUDE_DIRS"
${ARGN}
)
if(BUILD_TESTING)
set(_NAME ${ABSL_TEST_TARGET})
string(TOUPPER ${_NAME} _UPPER_NAME)
add_executable(${_NAME}_bin ${ABSL_TEST_SOURCES})
target_compile_options(${_NAME}_bin PRIVATE ${ABSL_COMPILE_CXXFLAGS} ${ABSL_TEST_PRIVATE_COMPILE_FLAGS})
target_link_libraries(${_NAME}_bin PUBLIC ${ABSL_TEST_PUBLIC_LIBRARIES} ${ABSL_TEST_COMMON_LIBRARIES})
target_include_directories(${_NAME}_bin
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_TEST_PUBLIC_INCLUDE_DIRS}
PRIVATE ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
)
add_test(${_NAME}_test ${_NAME}_bin)
endif(BUILD_TESTING)
endfunction()
function(check_target my_target)
if(NOT TARGET ${my_target})
message(FATAL_ERROR " ABSL: compiling absl requires a ${my_target} CMake target in your project,
see CMake/README.md for more details")
endif(NOT TARGET ${my_target})
endfunction()

73
CMake/README.md Normal file
View file

@ -0,0 +1,73 @@
## Abseil CMake build instructions
### Recommended usage : incorporate Abseil into an CMake project
For API / ABI compatibility reasons, it is recommended to build
and use abseil in a subdirectory of your project or as an embedded
dependency
This is similar to the recommended usage of the googletest framework
( https://github.com/google/googletest/blob/master/googletest/README.md )
Build and use step-by-step
1- Download abseil and copy it in a sub-directory in your project.
or add abseil as a git-submodule in your project
2- If not done yet, download and copy in your project the two dependencies of
abseil `cctz` and `googletest`
* cctz https://github.com/google/cctz
* googletest https://github.com/google/googletest
3- You can then use the cmake command `add_subdirectory()` to include
abseil directly and use the abseil targets in your project.
Note: Abseil requires CCTZ and the googletest framework. Consequently,
the targets `gtest`, `gtest_main`, `gmock` and `cctz` need
to be declared in your project before including abseil with `add_subdirectory`.
4- Add the absl:: target you wish to use to the `target_link_libraries()`
section of your executable or of your library
Here is a short CMakeLists.txt example of a possible project file
using abseil
cmake_minimum_required(VERSION 2.8.12)
project(my_project)
set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
add_subdirectory(googletest)
add_subdirectory(cctz)
add_subdirectory(abseil-cpp)
add_executable(my_exe source.cpp)
target_link_libraries(my_exe absl::base absl::synchronization absl::strings)
You will need to create your own CMake files for cctz until https://github.com/google/cctz/pull/54 lands. As of this writing, that pull request requires -DBUILD_TESTING=OFF as it doesn't correctly export cctz's dependency on Google Benchmark.
You will find here a non exhaustive list of absl public targets
absl::base
absl::algorithm
absl::container
absl::debugging
absl::memory
absl::meta
absl::numeric
absl::strings
absl::synchronization
absl::time
absl::utility

79
CMakeLists.txt Normal file
View file

@ -0,0 +1,79 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
cmake_minimum_required(VERSION 2.8.12)
project(absl)
# enable ctest
include(CTest)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake)
include(GNUInstallDirs)
include(AbseilHelpers)
# config options
set(ABSL_STD_CXX_FLAG "-std=c++11" CACHE STRING "c++ std flag (default: c++11)")
##
## Using absl targets
##
## all public absl targets are
## exported with the absl:: prefix
##
## e.g absl::base absl::synchronization absl::strings ....
##
## DO NOT rely on the internal targets outside of the prefix
# include current path
list(APPEND ABSL_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
# -std=X
set(CMAKE_CXX_FLAGS "${ABSL_STD_CXX_FLAG} ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_WARNING_VLA} ${CMAKE_CXX_FLAGS} ")
# find dependencies
## pthread
find_package(Threads REQUIRED)
# commented: used only for standalone test
#add_subdirectory(cctz)
#add_subdirectory(googletest)
## check targets
check_target(cctz)
check_target(gtest)
check_target(gtest_main)
check_target(gmock)
# -fexceptions
set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")
# fix stuff
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FIX_MSVC} ${CMAKE_CXX_FLAGS}")
list(APPEND ABSL_TEST_COMMON_LIBRARIES
gtest_main
gtest
gmock
${CMAKE_THREAD_LIBS_INIT}
)
add_subdirectory(absl)

View file

@ -10,6 +10,7 @@ standard library.
- [Codemap](#codemap)
- [License](#license)
- [Links](#links)
- [Build with cmake](#cmake)
<a name="about"></a>
## About Abseil
@ -84,3 +85,8 @@ For more information about Abseil:
* Peruse our
[Abseil Compatibility Guarantees](http://abseil.io/about/compatibility) to
understand both what we promise to you, and what we expect of you in return.
<a name="cmake"></a>
## Build with CMake
Please check the [CMake build instructions](CMake/README.md)

30
absl/CMakeLists.txt Normal file
View file

@ -0,0 +1,30 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
add_subdirectory(base)
add_subdirectory(algorithm)
add_subdirectory(container)
add_subdirectory(debugging)
add_subdirectory(memory)
add_subdirectory(meta)
add_subdirectory(numeric)
add_subdirectory(strings)
add_subdirectory(synchronization)
add_subdirectory(time)
add_subdirectory(types)
add_subdirectory(utility)

View file

@ -0,0 +1,63 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND ALGORITHM_PUBLIC_HEADERS
"algorithm.h"
"container.h"
)
#
## TESTS
#
# test algorithm_test
list(APPEND ALGORITHM_TEST_SRC
"algorithm_test.cc"
${ALGORITHM_PUBLIC_HEADERS}
${ALGORITHM_INTERNAL_HEADERS}
)
absl_header_library(
TARGET
absl_algorithm
EXPORT_NAME
algorithm
)
absl_test(
TARGET
algorithm_test
SOURCES
${ALGORITHM_TEST_SRC}
PUBLIC_LIBRARIES
absl::algorithm
)
# test container_test
set(CONTAINER_TEST_SRC "container_test.cc")
absl_test(
TARGET
container_test
SOURCES
${CONTAINER_TEST_SRC}
PUBLIC_LIBRARIES
absl::algorithm
)

341
absl/base/CMakeLists.txt Normal file
View file

@ -0,0 +1,341 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND BASE_PUBLIC_HEADERS
"attributes.h"
"call_once.h"
"casts.h"
"config.h"
"dynamic_annotations.h"
"macros.h"
"optimization.h"
"policy_checks.h"
"port.h"
"thread_annotations.h"
)
list(APPEND BASE_INTERNAL_HEADERS
"internal/atomic_hook.h"
"internal/cycleclock.h"
"internal/endian.h"
"internal/exception_testing.h"
"internal/identity.h"
"internal/invoke.h"
"internal/log_severity.h"
"internal/low_level_alloc.h"
"internal/low_level_scheduling.h"
"internal/malloc_extension_c.h"
"internal/malloc_extension.h"
"internal/malloc_hook_c.h"
"internal/malloc_hook.h"
"internal/malloc_hook_invoke.h"
"internal/per_thread_tls.h"
"internal/raw_logging.h"
"internal/scheduling_mode.h"
"internal/spinlock.h"
"internal/spinlock_wait.h"
"internal/sysinfo.h"
"internal/thread_identity.h"
"internal/throw_delegate.h"
"internal/tsan_mutex_interface.h"
"internal/unaligned_access.h"
"internal/unscaledcycleclock.h"
)
# absl_base main library
list(APPEND BASE_SRC
"internal/cycleclock.cc"
"internal/raw_logging.cc"
"internal/spinlock.cc"
"internal/sysinfo.cc"
"internal/thread_identity.cc"
"internal/unscaledcycleclock.cc"
"internal/low_level_alloc.cc"
"internal/malloc_hook.cc"
${BASE_PUBLIC_HEADERS}
${BASE_INTERNAL_HEADERS}
)
absl_library(
TARGET
absl_base
SOURCES
${BASE_SRC}
PUBLIC_LIBRARIES
absl_dynamic_annotations
absl_spinlock_wait
EXPORT_NAME
base
)
# malloc extension library
set(MALLOC_EXTENSION_SRC "internal/malloc_extension.cc")
set(MALLOC_EXTENSION_PUBLIC_LIBRARIES absl::base)
absl_library(
TARGET
absl_malloc_extension
SOURCES
${MALLOC_EXTENSION_SRC}
PUBLIC_LIBRARIES
${MALLOC_EXTENSION_PUBLIC_LIBRARIES}
EXPORT_NAME
malloc_extension
)
# throw delegate library
set(THROW_DELEGATE_SRC "internal/throw_delegate.cc")
absl_library(
TARGET
absl_throw_delegate
SOURCES
${THROW_DELEGATE_SRC}
PUBLIC_LIBRARIES
${THROW_DELEGATE_PUBLIC_LIBRARIES}
PRIVATE_COMPILE_FLAGS
${ABSL_EXCEPTIONS_FLAG}
EXPORT_NAME
throw_delegate
)
# dynamic_annotations library
set(DYNAMIC_ANNOTATIONS_SRC "dynamic_annotations.cc")
absl_library(
TARGET
absl_dynamic_annotations
SOURCES
${DYNAMIC_ANNOTATIONS_SRC}
)
# spinlock_wait library
set(SPINLOCK_WAIT_SRC "internal/spinlock_wait.cc")
absl_library(
TARGET
absl_spinlock_wait
SOURCES
${SPINLOCK_WAIT_SRC}
)
# malloc_internal library
list(APPEND MALLOC_INTERNAL_SRC
"internal/low_level_alloc.cc"
"internal/malloc_hook.cc"
"internal/malloc_hook_mmap_linux.inc"
)
absl_library(
TARGET
absl_malloc_internal
SOURCES
${MALLOC_INTERNAL_SRC}
PUBLIC_LIBRARIES
absl_dynamic_annotations
)
#
## TESTS
#
# call once test
set(CALL_ONCE_TEST_SRC "call_once_test.cc")
set(CALL_ONCE_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization)
absl_test(
TARGET
call_once_test
SOURCES
${CALL_ONCE_TEST_SRC}
PUBLIC_LIBRARIES
${CALL_ONCE_TEST_PUBLIC_LIBRARIES}
)
# test bit_cast_test
set(BIT_CAST_TEST_SRC "bit_cast_test.cc")
absl_test(
TARGET
bit_cast_test
SOURCES
${BIT_CAST_TEST_SRC}
)
# test absl_throw_delegate_test
set(THROW_DELEGATE_TEST_SRC "throw_delegate_test.cc")
set(THROW_DELEGATE_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate)
absl_test(
TARGET
throw_delegate_test
SOURCES
${THROW_DELEGATE_TEST_SRC}
PUBLIC_LIBRARIES
${THROW_DELEGATE_TEST_PUBLIC_LIBRARIES}
)
# test invoke_test
set(INVOKE_TEST_SRC "invoke_test.cc")
set(INVOKE_TEST_PUBLIC_LIBRARIES absl::strings)
absl_test(
TARGET
invoke_test
SOURCES
${INVOKE_TEST_SRC}
PUBLIC_LIBRARIES
${INVOKE_TEST_PUBLIC_LIBRARIES}
)
# test spinlock_test_common
set(SPINLOCK_TEST_COMMON_SRC "spinlock_test_common.cc")
set(SPINLOCK_TEST_COMMON_PUBLIC_LIBRARIES absl::base absl::synchronization)
absl_test(
TARGET
spinlock_test_common
SOURCES
${SPINLOCK_TEST_COMMON_SRC}
PUBLIC_LIBRARIES
${SPINLOCK_TEST_COMMON_PUBLIC_LIBRARIES}
)
# test spinlock_test
set(SPINLOCK_TEST_SRC "spinlock_test_common.cc")
set(SPINLOCK_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization)
absl_test(
TARGET
spinlock_test
SOURCES
${SPINLOCK_TEST_SRC}
PUBLIC_LIBRARIES
${SPINLOCK_TEST_PUBLIC_LIBRARIES}
)
# test endian_test
set(ENDIAN_TEST_SRC "internal/endian_test.cc")
absl_test(
TARGET
endian_test
SOURCES
${ENDIAN_TEST_SRC}
)
# test config_test
set(CONFIG_TEST_SRC "config_test.cc")
set(CONFIG_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization)
absl_test(
TARGET
config_test
SOURCES
${CONFIG_TEST_SRC}
PUBLIC_LIBRARIES
${CONFIG_TEST_PUBLIC_LIBRARIES}
)
# test raw_logging_test
set(RAW_LOGGING_TEST_SRC "raw_logging_test.cc")
set(RAW_LOGGING_TEST_PUBLIC_LIBRARIES absl::base)
absl_test(
TARGET
raw_logging_test
SOURCES
${RAW_LOGGING_TEST_SRC}
PUBLIC_LIBRARIES
${RAW_LOGGING_TEST_PUBLIC_LIBRARIES}
)
# test sysinfo_test
set(SYSINFO_TEST_SRC "internal/sysinfo_test.cc")
set(SYSINFO_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization)
absl_test(
TARGET
sysinfo_test
SOURCES
${SYSINFO_TEST_SRC}
PUBLIC_LIBRARIES
${SYSINFO_TEST_PUBLIC_LIBRARIES}
)
# test low_level_alloc_test
set(LOW_LEVEL_ALLOC_TEST_SRC "internal/low_level_alloc_test.cc")
set(LOW_LEVEL_ALLOC_TEST_PUBLIC_LIBRARIES absl::base)
absl_test(
TARGET
low_level_alloc_test
SOURCES
${LOW_LEVEL_ALLOC_TEST_SRC}
PUBLIC_LIBRARIES
${LOW_LEVEL_ALLOC_TEST_PUBLIC_LIBRARIES}
)
# test thread_identity_test
set(THREAD_IDENTITY_TEST_SRC "internal/thread_identity_test.cc")
set(THREAD_IDENTITY_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization)
absl_test(
TARGET
thread_identity_test
SOURCES
${THREAD_IDENTITY_TEST_SRC}
PUBLIC_LIBRARIES
${THREAD_IDENTITY_TEST_PUBLIC_LIBRARIES}
)
# test absl_malloc_extension_system_malloc_test
set(MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_SRC "internal/malloc_extension_test.cc")
set(MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_PUBLIC_LIBRARIES absl::base absl_malloc_extension)
set(MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_PRIVATE_COMPILE_FLAGS "-DABSL_MALLOC_EXTENSION_TEST_ALLOW_MISSING_EXTENSION=1")
absl_test(
TARGET
absl_malloc_extension_system_malloc_test
SOURCES
${MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_SRC}
PUBLIC_LIBRARIES
${MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_PUBLIC_LIBRARIES}
PRIVATE_COMPILE_FLAGS
${MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_PRIVATE_COMPILE_FLAGS}
)

View file

@ -0,0 +1,126 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND CONTAINER_PUBLIC_HEADERS
"fixed_array.h"
"inlined_vector.h"
)
list(APPEND CONTAINER_INTERNAL_HEADERS
"internal/test_instance_tracker.h"
)
absl_header_library(
TARGET
absl_container
EXPORT_NAME
container
)
#
## TESTS
#
list(APPEND TEST_INSTANCE_TRACKER_LIB_SRC
"internal/test_instance_tracker.cc"
${CONTAINER_PUBLIC_HEADERS}
${CONTAINER_INTERNAL_HEADERS}
)
absl_library(
TARGET
test_instance_tracker_lib
SOURCES
${TEST_INSTANCE_TRACKER_LIB_SRC}
PUBLIC_LIBRARIES
absl::container
DISABLE_INSTALL
)
# test fixed_array_test
set(FIXED_ARRAY_TEST_SRC "fixed_array_test.cc")
set(FIXED_ARRAY_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate test_instance_tracker_lib)
absl_test(
TARGET
fixed_array_test
SOURCES
${FIXED_ARRAY_TEST_SRC}
PUBLIC_LIBRARIES
${FIXED_ARRAY_TEST_PUBLIC_LIBRARIES}
PRIVATE_COMPILE_FLAGS
${ABSL_EXCEPTIONS_FLAG}
)
absl_test(
TARGET
fixed_array_test_noexceptions
SOURCES
${FIXED_ARRAY_TEST_SRC}
PUBLIC_LIBRARIES
${FIXED_ARRAY_TEST_PUBLIC_LIBRARIES}
)
# test inlined_vector_test
set(INLINED_VECTOR_TEST_SRC "inlined_vector_test.cc")
set(INLINED_VECTOR_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate test_instance_tracker_lib)
absl_test(
TARGET
inlined_vector_test
SOURCES
${INLINED_VECTOR_TEST_SRC}
PUBLIC_LIBRARIES
${INLINED_VECTOR_TEST_PUBLIC_LIBRARIES}
)
absl_test(
TARGET
inlined_vector_test_noexceptions
SOURCES
${INLINED_VECTOR_TEST_SRC}
PUBLIC_LIBRARIES
${INLINED_VECTOR_TEST_PUBLIC_LIBRARIES}
PRIVATE_COMPILE_FLAGS
${ABSL_NOEXCEPTION_CXXFLAGS}
)
# test test_instance_tracker_test
set(TEST_INSTANCE_TRACKER_TEST_SRC "internal/test_instance_tracker_test.cc")
set(TEST_INSTANCE_TRACKER_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate test_instance_tracker_lib)
absl_test(
TARGET
test_instance_tracker_test
SOURCES
${TEST_INSTANCE_TRACKER_TEST_SRC}
PUBLIC_LIBRARIES
${TEST_INSTANCE_TRACKER_TEST_PUBLIC_LIBRARIES}
)

View file

@ -0,0 +1,93 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND DEBUGGING_PUBLIC_HEADERS
"leak_check.h"
"stacktrace.h"
)
list(APPEND DEBUGGING_INTERNAL_HEADERS
"internal/address_is_readable.h"
"internal/elf_mem_image.h"
"internal/stacktrace_config.h"
"internal/vdso_support.h"
)
list(APPEND STACKTRACE_SRC
"stacktrace.cc"
"internal/address_is_readable.cc"
"internal/elf_mem_image.cc"
"internal/vdso_support.cc"
${DEBUGGING_PUBLIC_HEADERS}
${DEBUGGING_INTERNAL_HEADERS}
)
absl_library(
TARGET
absl_stacktrace
SOURCES
${STACKTRACE_SRC}
EXPORT_NAME
stacktrace
)
list(APPEND LEAK_CHECK_SRC
"leak_check.cc"
)
# leak_check library
absl_library(
TARGET
absl_leak_check
SOURCES
${LEAK_CHECK_SRC}
PUBLIC_LIBRARIES
absl_base
EXPORT_NAME
leak_check
)
# component target
absl_header_library(
TARGET
absl_debugging
PUBLIC_LIBRARIES
absl_stacktrace absl_leak_check
EXPORT_NAME
debugging
)
#
## TESTS
#
# test leak_check_test
list(APPEND LEAK_CHECK_TEST_SRC "leak_check_test.cc")
absl_test(
TARGET
leak_check_test
SOURCES
${LEAK_CHECK_TEST_SRC}
PUBLIC_LIBRARIES
absl_leak_check
)

View file

@ -0,0 +1,52 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND MEMORY_PUBLIC_HEADERS
"memory.h"
)
absl_header_library(
TARGET
absl_memory
EXPORT_NAME
memory
)
#
## TESTS
#
# test memory_test
list(APPEND MEMORY_TEST_SRC
"memory_test.cc"
${MEMORY_PUBLIC_HEADERS}
)
set(MEMORY_TEST_PUBLIC_LIBRARIES absl::base absl::memory)
absl_test(
TARGET
memory_test
SOURCES
${MEMORY_TEST_SRC}
PUBLIC_LIBRARIES
${MEMORY_TEST_PUBLIC_LIBRARIES}
)

49
absl/meta/CMakeLists.txt Normal file
View file

@ -0,0 +1,49 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND META_PUBLIC_HEADERS
"type_traits.h"
)
#
## TESTS
#
# test type_traits_test
list(APPEND TYPE_TRAITS_TEST_SRC
"type_traits_test.cc"
${META_PUBLIC_HEADERS}
)
absl_header_library(
TARGET
absl_meta
EXPORT_NAME
meta
)
absl_test(
TARGET
type_traits_test
SOURCES
${TYPE_TRAITS_TEST_SRC}
PUBLIC_LIBRARIES
${TYPE_TRAITS_TEST_PUBLIC_LIBRARIES} absl::meta
)

View file

@ -0,0 +1,62 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND NUMERIC_PUBLIC_HEADERS
"int128.h"
)
# library 128
list(APPEND INT128_SRC
"int128.cc"
${NUMERIC_PUBLIC_HEADERS}
)
absl_library(
TARGET
absl_int128
SOURCES
${INT128_SRC}
PUBLIC_LIBRARIES
${INT128_PUBLIC_LIBRARIES}
EXPORT_NAME
int128
)
absl_header_library(
TARGET
absl_numeric
PUBLIC_LIBRARIES
absl::int128
EXPORT_NAME
numeric
)
# test int128_test
set(INT128_TEST_SRC "int128_test.cc")
set(INT128_TEST_PUBLIC_LIBRARIES absl::numeric absl::base)
absl_test(
TARGET
int128_test
SOURCES
${INT128_TEST_SRC}
PUBLIC_LIBRARIES
${INT128_TEST_PUBLIC_LIBRARIES}
)

299
absl/strings/CMakeLists.txt Normal file
View file

@ -0,0 +1,299 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND STRINGS_PUBLIC_HEADERS
"ascii.h"
"escaping.h"
"match.h"
"numbers.h"
"str_cat.h"
"string_view.h"
"strip.h"
"str_join.h"
"str_replace.h"
"str_split.h"
"substitute.h"
)
list(APPEND STRINGS_INTERNAL_HEADERS
"internal/char_map.h"
"internal/memutil.h"
"internal/ostringstream.h"
"internal/resize_uninitialized.h"
"internal/str_join_internal.h"
"internal/str_split_internal.h"
"internal/utf8.h"
)
# add string library
list(APPEND STRINGS_SRC
"ascii.cc"
"escaping.cc"
"internal/memutil.cc"
"internal/memutil.h"
"internal/utf8.cc"
"match.cc"
"numbers.cc"
"str_cat.cc"
"str_replace.cc"
"str_split.cc"
"string_view.cc"
"substitute.cc"
${STRINGS_PUBLIC_HEADERS}
${STRINGS_INTERNAL_HEADERS}
)
set(STRINGS_PUBLIC_LIBRARIES absl::base absl_throw_delegate)
absl_library(
TARGET
absl_strings
SOURCES
${STRINGS_SRC}
PUBLIC_LIBRARIES
${STRINGS_PUBLIC_LIBRARIES}
EXPORT_NAME
strings
)
#
## TESTS
#
# test match_test
set(MATCH_TEST_SRC "match_test.cc")
set(MATCH_TEST_PUBLIC_LIBRARIES absl::strings)
absl_test(
TARGET
match_test
SOURCES
${MATCH_TEST_SRC}
PUBLIC_LIBRARIES
${MATCH_TEST_PUBLIC_LIBRARIES}
)
# test escaping_test
set(ESCAPING_TEST_SRC "escaping_test.cc")
set(ESCAPING_TEST_PUBLIC_LIBRARIES absl::strings absl::base)
absl_test(
TARGET
escaping_test
SOURCES
${ESCAPING_TEST_SRC}
PUBLIC_LIBRARIES
${ESCAPING_TEST_PUBLIC_LIBRARIES}
)
# test ascii_test
set(ASCII_TEST_SRC "ascii_test.cc")
set(ASCII_TEST_PUBLIC_LIBRARIES absl::strings)
absl_test(
TARGET
ascii_test
SOURCES
${ASCII_TEST_SRC}
PUBLIC_LIBRARIES
${ASCII_TEST_PUBLIC_LIBRARIES}
)
# test memutil_test
set(MEMUTIL_TEST_SRC "internal/memutil_test.cc")
set(MEMUTIL_TEST_PUBLIC_LIBRARIES absl::strings)
absl_test(
TARGET
memutil_test
SOURCES
${MEMUTIL_TEST_SRC}
PUBLIC_LIBRARIES
${MEMUTIL_TEST_PUBLIC_LIBRARIES}
)
# test utf8_test
set(UTF8_TEST_SRC "internal/utf8_test.cc")
set(UTF8_TEST_PUBLIC_LIBRARIES absl::strings absl::base)
absl_test(
TARGET
utf8_test
SOURCES
${UTF8_TEST_SRC}
PUBLIC_LIBRARIES
${UTF8_TEST_PUBLIC_LIBRARIES}
)
# test string_view_test
set(STRING_VIEW_TEST_SRC "string_view_test.cc")
set(STRING_VIEW_TEST_PUBLIC_LIBRARIES absl::strings absl_throw_delegate absl::base)
absl_test(
TARGET
string_view_test
SOURCES
${STRING_VIEW_TEST_SRC}
PUBLIC_LIBRARIES
${STRING_VIEW_TEST_PUBLIC_LIBRARIES}
)
# test substitute_test
set(SUBSTITUTE_TEST_SRC "substitute_test.cc")
set(SUBSTITUTE_TEST_PUBLIC_LIBRARIES absl::strings absl::base)
absl_test(
TARGET
substitute_test
SOURCES
${SUBSTITUTE_TEST_SRC}
PUBLIC_LIBRARIES
${SUBSTITUTE_TEST_PUBLIC_LIBRARIES}
)
# test str_replace_test
set(STR_REPLACE_TEST_SRC "str_replace_test.cc")
set(STR_REPLACE_TEST_PUBLIC_LIBRARIES absl::strings absl::base absl_throw_delegate)
absl_test(
TARGET
str_replace_test
SOURCES
${STR_REPLACE_TEST_SRC}
PUBLIC_LIBRARIES
${STR_REPLACE_TEST_PUBLIC_LIBRARIES}
)
# test str_split_test
set(STR_SPLIT_TEST_SRC "str_split_test.cc")
set(STR_SPLIT_TEST_PUBLIC_LIBRARIES absl::strings absl::base absl_throw_delegate)
absl_test(
TARGET
str_split_test
SOURCES
${STR_SPLIT_TEST_SRC}
PUBLIC_LIBRARIES
${STR_SPLIT_TEST_PUBLIC_LIBRARIES}
)
# test ostringstream_test
set(OSTRINGSTREAM_TEST_SRC "internal/ostringstream_test.cc")
absl_test(
TARGET
ostringstream_test
SOURCES
${OSTRINGSTREAM_TEST_SRC}
)
# test resize_uninitialized_test
set(RESIZE_UNINITIALIZED_TEST_SRC "internal/resize_uninitialized_test.cc")
absl_test(
TARGET
resize_uninitialized_test
SOURCES
${RESIZE_UNINITIALIZED_TEST_SRC}
)
# test str_join_test
set(STR_JOIN_TEST_SRC "str_join_test.cc")
set(STR_JOIN_TEST_PUBLIC_LIBRARIES absl::strings)
absl_test(
TARGET
str_join_test
SOURCES
${STR_JOIN_TEST_SRC}
PUBLIC_LIBRARIES
${STR_JOIN_TEST_PUBLIC_LIBRARIES}
)
# test str_cat_test
set(STR_CAT_TEST_SRC "str_cat_test.cc")
set(STR_CAT_TEST_PUBLIC_LIBRARIES absl::strings)
absl_test(
TARGET
str_cat_test
SOURCES
${STR_CAT_TEST_SRC}
PUBLIC_LIBRARIES
${STR_CAT_TEST_PUBLIC_LIBRARIES}
)
# test numbers_test
set(NUMBERS_TEST_SRC "numbers_test.cc")
set(NUMBERS_TEST_PUBLIC_LIBRARIES absl::strings)
absl_test(
TARGET
numbers_test
SOURCES
${NUMBERS_TEST_SRC}
PUBLIC_LIBRARIES
${NUMBERS_TEST_PUBLIC_LIBRARIES}
)
# test strip_test
set(STRIP_TEST_SRC "strip_test.cc")
set(STRIP_TEST_PUBLIC_LIBRARIES absl::strings)
absl_test(
TARGET
strip_test
SOURCES
${STRIP_TEST_SRC}
PUBLIC_LIBRARIES
${STRIP_TEST_PUBLIC_LIBRARIES}
)
# test char_map_test
set(CHAR_MAP_TEST_SRC "internal/char_map_test.cc")
set(CHAR_MAP_TEST_PUBLIC_LIBRARIES absl::strings)
absl_test(
TARGET
char_map_test
SOURCES
${CHAR_MAP_TEST_SRC}
PUBLIC_LIBRARIES
${CHAR_MAP_TEST_PUBLIC_LIBRARIES}
)

View file

@ -0,0 +1,154 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND SYNCHRONIZATION_PUBLIC_HEADERS
"barrier.h"
"blocking_counter.h"
"mutex.h"
"notification.h"
)
list(APPEND SYNCHRONIZATION_INTERNAL_HEADERS
"internal/create_thread_identity.h"
"internal/graphcycles.h"
"internal/kernel_timeout.h"
"internal/per_thread_sem.h"
"internal/thread_pool.h"
"internal/waiter.h"
)
# syncrhonisation library
list(APPEND SYNCHRONIZATION_SRC
"barrier.cc"
"blocking_counter.cc"
"internal/create_thread_identity.cc"
"internal/per_thread_sem.cc"
"internal/waiter.cc"
"internal/graphcycles.cc"
"notification.cc"
"mutex.cc"
)
set(SYNCHRONIZATION_PUBLIC_LIBRARIES absl::base absl_malloc_extension absl::time)
absl_library(
TARGET
absl_synchronization
SOURCES
${SYNCHRONIZATION_SRC}
PUBLIC_LIBRARIES
${SYNCHRONIZATION_PUBLIC_LIBRARIES}
EXPORT_NAME
synchronization
)
#
## TESTS
#
# test barrier_test
set(BARRIER_TEST_SRC "barrier_test.cc")
set(BARRIER_TEST_PUBLIC_LIBRARIES absl::synchronization)
absl_test(
TARGET
barrier_test
SOURCES
${BARRIER_TEST_SRC}
PUBLIC_LIBRARIES
${BARRIER_TEST_PUBLIC_LIBRARIES}
)
# test blocking_counter_test
set(BLOCKING_COUNTER_TEST_SRC "blocking_counter_test.cc")
set(BLOCKING_COUNTER_TEST_PUBLIC_LIBRARIES absl::synchronization)
absl_test(
TARGET
blocking_counter_test
SOURCES
${BLOCKING_COUNTER_TEST_SRC}
PUBLIC_LIBRARIES
${BLOCKING_COUNTER_TEST_PUBLIC_LIBRARIES}
)
# test graphcycles_test
set(GRAPHCYCLES_TEST_SRC "internal/graphcycles_test.cc")
set(GRAPHCYCLES_TEST_PUBLIC_LIBRARIES absl::synchronization)
absl_test(
TARGET
graphcycles_test
SOURCES
${GRAPHCYCLES_TEST_SRC}
PUBLIC_LIBRARIES
${GRAPHCYCLES_TEST_PUBLIC_LIBRARIES}
)
# test mutex_test
set(MUTEX_TEST_SRC "mutex_test.cc")
set(MUTEX_TEST_PUBLIC_LIBRARIES absl::synchronization)
absl_test(
TARGET
mutex_test
SOURCES
${MUTEX_TEST_SRC}
PUBLIC_LIBRARIES
${MUTEX_TEST_PUBLIC_LIBRARIES}
)
# test notification_test
set(NOTIFICATION_TEST_SRC "notification_test.cc")
set(NOTIFICATION_TEST_PUBLIC_LIBRARIES absl::synchronization)
absl_test(
TARGET
notification_test
SOURCES
${NOTIFICATION_TEST_SRC}
PUBLIC_LIBRARIES
${NOTIFICATION_TEST_PUBLIC_LIBRARIES}
)
# test per_thread_sem_test_common
set(PER_THREAD_SEM_TEST_COMMON_SRC "internal/per_thread_sem_test.cc")
set(PER_THREAD_SEM_TEST_COMMON_PUBLIC_LIBRARIES absl::synchronization absl::strings)
absl_test(
TARGET
per_thread_sem_test_common
SOURCES
${PER_THREAD_SEM_TEST_COMMON_SRC}
PUBLIC_LIBRARIES
${PER_THREAD_SEM_TEST_COMMON_PUBLIC_LIBRARIES}
)

78
absl/time/CMakeLists.txt Normal file
View file

@ -0,0 +1,78 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND TIME_PUBLIC_HEADERS
"clock.h"
"time.h"
)
list(APPEND TIME_INTERNAL_HEADERS
"internal/test_util.h"
)
list(APPEND TIME_SRC
"time.cc"
"clock.cc"
"duration.cc"
"format.cc"
${TIME_PUBLIC_HEADERS}
${TIME_INTERNAL_HEADERS}
)
set(TIME_PUBLIC_LIBRARIES absl::base absl::stacktrace absl::int128 cctz)
absl_library(
TARGET
absl_time
SOURCES
${TIME_SRC}
PUBLIC_LIBRARIES
${TIME_PUBLIC_LIBRARIES}
PUBLIC_INCLUDE_DIRS
${CCTZ_INCLUDE_DIRS}
EXPORT_NAME
time
)
#
## TESTS
#
# test time_test
list(APPEND TIME_TEST_SRC
"time_test.cc"
"clock_test.cc"
"duration_test.cc"
"format_test.cc"
"time_norm_test.cc"
"time_test.cc"
"time_zone_test.cc"
"internal/test_util.cc"
)
set(TIME_TEST_PUBLIC_LIBRARIES absl::time)
absl_test(
TARGET
time_test
SOURCES
${TIME_TEST_SRC}
PUBLIC_LIBRARIES
${TIME_TEST_PUBLIC_LIBRARIES}
)

171
absl/types/CMakeLists.txt Normal file
View file

@ -0,0 +1,171 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND TYPES_PUBLIC_HEADERS
"any.h"
"bad_any_cast.h"
"bad_optional_access.h"
"optional.h"
"span.h"
)
# any library
absl_header_library(
TARGET
absl_any
PUBLIC_LIBRARIES
absl::utility
EXPORT_NAME
any
)
# span library
absl_header_library(
TARGET
absl_span
PUBLIC_LIBRARIES
absl::utility
EXPORT_NAME
span
)
# bad_any_cast library
list(APPEND BAD_ANY_CAST_SRC
"bad_any_cast.cc"
${TYPES_PUBLIC_HEADERS}
)
absl_library(
TARGET
absl_bad_any_cast
SOURCES
${BAD_ANY_CAST_SRC}
PUBLIC_LIBRARIES
absl::base absl::any
EXPORT_NAME
bad_any_cast
)
# optional library
list(APPEND OPTIONAL_SRC
"optional.cc"
)
absl_library(
TARGET
absl_optional
SOURCES
${OPTIONAL_SRC}
PUBLIC_LIBRARIES
absl::base
EXPORT_NAME
optional
)
set(BAD_OPTIONAL_ACCESS_SRC "bad_optional_access.cc")
set(BAD_OPTIONAL_ACCESS_LIBRARIES absl::base)
absl_library(
TARGET
absl_bad_optional_access
SOURCES
${BAD_OPTIONAL_ACCESS_SRC}
PUBLIC_LIBRARIES
${BAD_OPTIONAL_ACCESS_PUBLIC_LIBRARIES}
EXPORT_NAME
bad_optional_access
)
#
## TESTS
#
# test any_test
set(ANY_TEST_SRC "any_test.cc")
set(ANY_TEST_PUBLIC_LIBRARIES absl::base absl::throw_delegate absl::any absl::bad_any_cast test_instance_tracker_lib)
absl_test(
TARGET
any_test
SOURCES
${ANY_TEST_SRC}
PUBLIC_LIBRARIES
${ANY_TEST_PUBLIC_LIBRARIES}
PRIVATE_COMPILE_FLAGS
${ABSL_EXCEPTIONS_FLAG}
)
# test any_test_noexceptions
absl_test(
TARGET
any_test_noexceptions
SOURCES
${ANY_TEST_SRC}
PUBLIC_LIBRARIES
${ANY_TEST_PUBLIC_LIBRARIES}
)
# test span_test
set(SPAN_TEST_SRC "span_test.cc")
set(SPAN_TEST_PUBLIC_LIBRARIES absl::base absl::strings absl::throw_delegate absl::span test_instance_tracker_lib)
absl_test(
TARGET
span_test
SOURCES
${SPAN_TEST_SRC}
PUBLIC_LIBRARIES
${SPAN_TEST_PUBLIC_LIBRARIES}
PRIVATE_COMPILE_FLAGS
${ABSL_EXCEPTIONS_FLAG}
)
# test span_test_noexceptions
absl_test(
TARGET
span_test_noexceptions
SOURCES
${SPAN_TEST_SRC}
PUBLIC_LIBRARIES
${SPAN_TEST_PUBLIC_LIBRARIES}
)
# test optional_test
set(OPTIONAL_TEST_SRC "optional_test.cc")
set(OPTIONAL_TEST_PUBLIC_LIBRARIES absl::base absl::throw_delegate absl::optional absl_bad_optional_access)
absl_test(
TARGET
optional_test
SOURCES
${OPTIONAL_TEST_SRC}
PUBLIC_LIBRARIES
${OPTIONAL_TEST_PUBLIC_LIBRARIES}
)

View file

@ -0,0 +1,60 @@
#
# Copyright 2017 The Abseil Authors.
#
# 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
#
# http://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.
#
list(APPEND UTILITY_PUBLIC_HEADERS
"utility.h"
)
list(APPEND UTILITY_SRC
"utility.cc"
${UTILITY_PUBLIC_HEADERS}
)
absl_library(
TARGET
absl_utility
SOURCES
${UTILITY_SRC}
PUBLIC_LIBRARIES
${UTILITY_PUBLIC_LIBRARIES}
EXPORT_NAME
utility
)
#
## TESTS
#
# test utility_test
set(UTILITY_TEST_SRC "utility_test.cc")
set(UTILITY_TEST_PUBLIC_LIBRARIES absl::utility)
absl_test(
TARGET
utility_test
SOURCES
${UTILITY_TEST_SRC}
PUBLIC_LIBRARIES
${UTILITY_TEST_PUBLIC_LIBRARIES}
)