xref: /aosp_15_r20/external/cronet/third_party/cpu_features/src/cmake/README.md (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# CMake build instructions
2
3## Recommended usage : Incorporating cpu_features into a CMake project
4
5For API / ABI compatibility reasons, it is recommended to build and use
6cpu_features in a subdirectory of your project or as an embedded dependency.
7
8This is similar to the recommended usage of the googletest framework
9( https://github.com/google/googletest/blob/main/googletest/README.md )
10
11Build and use step-by-step
12
13
141- Download cpu_features and copy it in a sub-directory in your project.
15or add cpu_features as a git-submodule in your project
16
172- You can then use the cmake command `add_subdirectory()` to include
18cpu_features directly and use the `cpu_features` target in your project.
19
203- Add the `CpuFeature::cpu_features` target to the `target_link_libraries()` section of
21your executable or of your library.
22
23## Disabling tests
24
25CMake default options for cpu_features is `Release` built type with tests
26enabled. To disable testing set cmake `BUILD_TESTING` variable to `OFF`.
27e.g.
28```sh
29cmake -S. -Bbuild -DBUILD_TESTING=OFF
30```
31