Lines Matching +full:cmake +full:-
1 # Abseil CMake Build Instructions
3 Abseil comes with a CMake build script ([CMakeLists.txt](../CMakeLists.txt))
4 that can be used on a wide range of platforms ("C" stands for cross-platform.).
5 If you don't have CMake installed already, you can download it for free from
6 <https://www.cmake.org/>.
8 CMake works by generating native makefiles or build projects that can
14 ## Incorporating Abseil Into a CMake Project
16 The recommendations below are similar to those for using CMake within the
18 …m/google/googletest/blob/master/googletest/README.md#incorporating-into-an-existing-cmake-project>)
20 ### Step-by-Step Instructions
23 [Google Test](https://github.com/google/googletest) into your CMake
25 `-DBUILD_TESTING=OFF` or `-DABSL_BUILD_TESTING=OFF` when configuring your
26 project with CMake.
28 2. Download Abseil and copy it into a subdirectory in your CMake project or add
29 Abseil as a [git submodule](https://git-scm.com/docs/git-submodule) in your
30 CMake project.
32 3. You can then use the CMake command
33 [`add_subdirectory()`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html)
34 to include Abseil directly in your CMake project.
37 [`target_link_libraries()`](https://cmake.org/cmake/help/latest/command/target_link_libraries.html)
41 ```cmake
50 add_subdirectory(abseil-cpp)
58 the current top-level CMake project) and configure the minimum required C++
64 ```cmake
69 # current top-level CMake project.
75 add_subdirectory(abseil-cpp)
91 Then the top-level application project that uses your library is responsible for
94 ### Running Abseil Tests with CMake
96 Use the `-DABSL_BUILD_TESTING=ON` flag to run Abseil tests. Note that
102 * Use `-DABSL_USE_GOOGLETEST_HEAD`. This will automatically download the latest
106 https://github.com/google/googletest/blob/master/googletest/README.md#using-cmake
107 for more information on using Googletest in a CMake project.
112 cd path/to/abseil-cpp
115 cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON ..
116 make -j
120 Currently, we only run our tests with CMake in a Linux environment, but we are
122 https://github.com/abseil/abseil-cpp/projects/1 and
123 https://github.com/abseil/abseil-cpp/issues/109 for more information.
125 ### Available Abseil CMake Public Targets
127 Here's a non-exhaustive list of Abseil CMake public targets:
129 ```cmake
145 ## Traditional CMake Set-Up
147 For larger projects, it may make sense to use the traditional CMake set-up where you build and inst…
151 cmake -S /source/googletest -B /build/googletest -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=…
152 cmake --build /build/googletest --target install
157 cmake -S /source/abseil-cpp -B /build/abseil-cpp -DCMAKE_PREFIX_PATH=/installation/dir -DCMAKE_INST…
158 cmake --build /temporary/build/abseil-cpp
165 ctest --test-dir /temporary/build/abseil-cpp
170 cmake --build /temporary/build/abseil-cpp --target install
173 # CMake Option Synopsis
175 ## Enable Standard CMake Installation
177 `-DABSL_ENABLE_INSTALL=ON`
181 `-DABSL_BUILD_TESTING=ON` must be set to enable testing
183 - Have Abseil download and build Google Test for you: `-DABSL_USE_EXTERNAL_GOOGLETEST=OFF` (default)
184 - Download and build latest Google Test: `-DABSL_USE_GOOGLETEST_HEAD=ON`
185 …- Download specific Google Test version (ZIP archive): `-DABSL_GOOGLETEST_DOWNLOAD_URL=https://...…
186 - Use Google Test from specific local directory: `-DABSL_LOCAL_GOOGLETEST_DIR=/path/to/googletest`
187 - Use Google Test included elsewhere in your project: `-DABSL_USE_EXTERNAL_GOOGLETEST=ON`
188 - Use standard CMake `find_package(CTest)` to find installed Google Test: `-DABSL_USE_EXTERNAL_GOOG…