1# Copyright 2019 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# If Sandboxed API is built from a plain checkout, built everything. 16# Otherwise, skip tests and examples. 17if(SAPI_PROJECT_IS_TOP_LEVEL) 18 set(_sapi_enable_tests_examples_default ON) 19else() 20 set(_sapi_enable_tests_examples_default OFF) 21endif() 22 23# These options determine whether CMake should download the libraries that 24# Sandboxed API depends on at configure time. 25# The CMake script SapiDeps.cmake checks for the presence of certain build 26# targets to determine whether a library can be used. Disabling the options 27# below enables embedding projects to selectively override/replace these 28# dependencies. This is useful for cases where embedding projects already 29# depend on some of these libraries (e.g. Abseil). 30option(SAPI_DOWNLOAD_ABSL "Download Abseil at config time" ON) 31option(SAPI_DOWNLOAD_GOOGLETEST "Download googletest at config time" ON) 32option(SAPI_DOWNLOAD_BENCHMARK "Download benchmark at config time" ON) 33option(SAPI_DOWNLOAD_PROTOBUF "Download protobuf at config time" ON) 34option(SAPI_DOWNLOAD_LIBUNWIND "Download libunwind at config time" ON) 35option(SAPI_DOWNLOAD_LIBCAP "Download libcap at config time" ON) 36option(SAPI_DOWNLOAD_LIBFFI "Download libffi at config time" ON) 37 38# Options for building examples 39option(SAPI_BUILD_EXAMPLES 40 "If ON, build example code" ${_sapi_enable_tests_examples_default} 41) 42option(SAPI_DOWNLOAD_ZLIB 43 "Download zlib at config time (only if SAPI_BUILD_EXAMPLES is set)" 44 ${_sapi_enable_tests_examples_default} 45) 46 47option(SAPI_BUILD_TESTING 48 "If ON, this will build all of Sandboxed API's own tests" 49 ${_sapi_enable_tests_examples_default} 50) 51# Disabled by default, as this will download a lot of extra content. 52option(SAPI_CONTRIB_BUILD_TESTING "Build tests for sandboxes in 'contrib'" OFF) 53 54option(SAPI_ENABLE_CLANG_TOOL 55 "Use the new Clang tool based header generator" OFF 56) 57option(SAPI_ENABLE_CLANG_TOOL_STATIC 58 "Link the Clang libraries statically into the tool" OFF 59) 60 61# This flag should be only enabled for embedded and resource-constrained 62# environments. 63option(SAPI_ENABLE_SHARED_LIBS "Build SAPI shared libs" OFF) 64 65option(SAPI_HARDENED_SOURCE "Build with hardening compiler options" OFF) 66 67option(SAPI_FORCE_COLOR_OUTPUT 68 "Force colored compiler diagnostics when using Ninja" ON 69) 70