mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
CMake: Make the path to the Clang tool configurable
Set `SAPI_CLANG_TOOL_EXECUTABLE` to specify the location of a pre-built Clang tool based header generator. PiperOrigin-RevId: 531425738 Change-Id: I723d19122cc738d9906c8c568d156d44c58d9746
This commit is contained in:
parent
4925df5419
commit
b6cc0ce80d
|
@ -155,8 +155,12 @@ function(add_sapi_library)
|
|||
if(SAPI_ENABLE_CLANG_TOOL)
|
||||
set(_sapi_isystem_args ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
|
||||
list(TRANSFORM _sapi_isystem_args PREPEND --extra-arg-before=-isystem)
|
||||
if(SAPI_CLANG_TOOL_EXECUTABLE)
|
||||
list(APPEND _sapi_generator_command "${SAPI_CLANG_TOOL_EXECUTABLE}")
|
||||
else()
|
||||
list(APPEND _sapi_generator_command sapi_generator_tool)
|
||||
endif()
|
||||
list(APPEND _sapi_generator_command
|
||||
sapi_generator_tool
|
||||
-p "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${_sapi_generator_args}
|
||||
${_sapi_isystem_args}
|
||||
|
|
|
@ -95,7 +95,13 @@ endif()
|
|||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if(NOT SAPI_ENABLE_CLANG_TOOL)
|
||||
if(SAPI_ENABLE_CLANG_TOOL)
|
||||
# If unset (the default), CMake will build the tool first and add it as a
|
||||
# dependency.
|
||||
set(SAPI_CLANG_TOOL_EXECUTABLE "" CACHE FILEPATH
|
||||
"Path to the Clang tool based header generator"
|
||||
)
|
||||
else()
|
||||
# Find Python 3 and add its location to the cache so that its available in
|
||||
# the add_sapi_library() macro in embedding projects.
|
||||
find_package(Python3 COMPONENTS Interpreter REQUIRED)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
add_subdirectory(tools/filewrapper)
|
||||
add_subdirectory(sandbox2)
|
||||
add_subdirectory(util)
|
||||
if(SAPI_ENABLE_CLANG_TOOL)
|
||||
if(SAPI_ENABLE_CLANG_TOOL AND NOT SAPI_CLANG_TOOL_EXECUTABLE)
|
||||
add_subdirectory(tools/clang_generator)
|
||||
endif()
|
||||
add_subdirectory(examples)
|
||||
|
|
Loading…
Reference in New Issue
Block a user