-44b0fafc62Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -926bfeb9ffExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -13327debebExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -3088e76c59Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -f6ae816808Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -a06c4a1d90Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -7b46e1d31aExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -070f6e47b3Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -7990fd459eExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -f95179062eExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -cc8dcd307bExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -a705aa78dcMerge pull request #194 from Mizux/windows by Xiaoyi Zhang <zhangxy988@gmail.com> -a4c3ffff11Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -0117457865Merge pull request #201 from ccawley2011/fix-byteswap by Matt Calabrese <38107210+mattcalabrese-google@users.noreply.github.com> -f86f941385Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -94c298e2a0Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -0884a6a04eExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -c16d5557cdExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -45221ccc4eExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -2019e17a52Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -5b70a8910bExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -a00bdd176dExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -f340f773edExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -445998d7acExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -e821380d69Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -f21d187b80Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -5441bbe1dbFix code snippet in comment (#174) by Loo Rong Jie <loorongjie@gmail.com> -5aae0cffaeFix CMake build (#173) by Stephan Dollberg <stephan.dollberg@gmail.com> -48cd2c3f35Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -e291c279e4Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -e01d95528eExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -8ff1374008Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -02451914b9Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -921fd5cf02Merge pull request #166 from rongjiecomputer/cmake-test by Gennadiy Civil <gennadiycivil@users.noreply.github.com> -fb462224c0Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -c075ad3216Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -0f4bc96675Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -6c7e5ffc43Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -d6df769173Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -28080f5f05Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -9c987f429bExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -5e7d459eecExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -bed5bd6e18Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -fefc83638fExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -d8cfe9f2a7Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -ad5c960b2eExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -86f0fe93adExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -f0f15c2778Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -29ff6d4860Removed "warning treated as error" flag from MSVC (#153) by vocaviking <vocaviking@users.noreply.github.com> -083d04dd4aExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -bea85b5273Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -8f96be6ca6Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -92e07e5590Merge pull request #152 from clnperez/fix-multi-defines-p... by Derek Mauro <761129+derekmauro@users.noreply.github.com> -2125e6444aExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -9acad869d2Merge pull request #150 from OlafvdSpek/patch-2 by Jonathan Cohen <cohenjon@google.com> -c2e00d3419Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -9e060686d1Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -7aa411ceafExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -2c5af55ed3Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -44aa275286Merge pull request #143 from rongjiecomputer/kernel by Xiaoyi Zhang <zhangxy988@gmail.com> -42f22a2840Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -b973bc53efMerge pull request #139 from siepkes/smartos-support by ahedberg <ahedberg@google.com> -e0def7473eExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -f826f1d489Merge pull request #138 from edbaunton/remove-deprecated-... by ahedberg <ahedberg@google.com> -7b50a4a94bExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -a5030ca512Merge pull request #144 from rongjiecomputer/winsock2 by Xiaoyi Zhang <zhangxy988@gmail.com> -02687955b7Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -8f612ebb15Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -134496a31dExport of internal Abseil changes. by Abseil Team <absl-team@google.com> -ba8d6cf077Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -be1e84b988Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -16ac2ec2e3Merge pull request #134 from rongjiecomputer/cmake by Alex Strelnikov <strel@google.com> -7efd8dc0f1Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -87a4c07856Export of internal Abseil changes. by Abseil Team <absl-team@google.com> -4491d606dfExport of internal Abseil changes. by Abseil Team <absl-team@google.com> GitOrigin-RevId:44b0fafc62Change-Id: I2c427b5b41b2d34101922048b00f3d9dafcb498d
Abseil CMake Build Instructions
Abseil comes with a CMake build script (CMakeLists.txt) that can be used on a wide range of platforms ("C" stands for cross-platform.). If you don't have CMake installed already, you can download it for free from http://www.cmake.org/.
CMake works by generating native makefiles or build projects that can be used in the compiler environment of your choice.
For API/ABI compatibility reasons, we strongly recommend building Abseil in a subdirectory of your project or as an embedded dependency.
Incorporating Abseil Into a CMake Project
The recommendations below are similar to those for using CMake within the googletest framework (https://github.com/google/googletest/blob/master/googletest/README.md#incorporating-into-an-existing-cmake-project)
Step-by-Step Instructions
-
If you want to build the Abseil tests, integrate the Abseil dependency Google Test into your CMake project. To disable Abseil tests, you have to pass
-DBUILD_TESTING=OFFwhen configuring your project with CMake. -
Download Abseil and copy it into a subdirectory in your CMake project or add Abseil as a git submodule in your CMake project.
-
You can then use the CMake command
add_subdirectory()to include Abseil directly in your CMake project. -
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 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}")
if(MSVC)
# /wd4005 macro-redefinition
# /wd4068 unknown pragma
# /wd4244 conversion from 'type1' to 'type2'
# /wd4267 conversion from 'size_t' to 'type2'
# /wd4800 force value to bool 'true' or 'false' (performance warning)
add_compile_options(/wd4005 /wd4068 /wd4244 /wd4267 /wd4800)
add_definitions(/DNOMINMAX /DWIN32_LEAN_AND_MEAN=1 /D_CRT_SECURE_NO_WARNINGS)
endif()
add_subdirectory(abseil-cpp)
add_executable(my_exe source.cpp)
target_link_libraries(my_exe absl::base absl::synchronization absl::strings)
Running Abseil Tests with CMake
Use the -DABSL_RUN_TESTS=ON flag to run Abseil tests. Note that if the -DBUILD_TESTING=OFF flag is passed then Abseil tests will not be run.
You will need to provide Abseil with a Googletest dependency. There are two options for how to do this:
- Use
-DABSL_USE_GOOGLETEST_HEAD. This will automatically download the latest Googletest source into the build directory at configure time. Googletest will then be compiled directly alongside Abseil's tests. - Manually integrate Googletest with your build. See https://github.com/google/googletest/blob/master/googletest/README.md#using-cmake for more information on using Googletest in a CMake project.
For example, to run just the Abseil tests, you could use this script:
cd path/to/abseil-cpp
mkdir build
cd build
cmake -DABSL_USE_GOOGLETEST_HEAD=ON -DABSL_RUN_TESTS=ON ..
make -j
ctest
Currently, we only run our tests with CMake in a Linux environment, but we are working on the rest of our supported platforms. See https://github.com/abseil/abseil-cpp/projects/1 and https://github.com/abseil/abseil-cpp/issues/109 for more information.
Available Abseil CMake Public Targets
Here's a non-exhaustive list of Abseil CMake public targets:
absl::base
absl::algorithm
absl::container
absl::debugging
absl::memory
absl::meta
absl::numeric
absl::strings
absl::synchronization
absl::time
absl::utility