Skip to content
Snippets Groups Projects
Commit 3ec8d7f5 authored by Leander Bessa Beernaert's avatar Leander Bessa Beernaert Committed by Wouter van Oortmerssen
Browse files

Added option FLATBUFFERS_BUILD_FLATC

When FLATBUFFERS_BUILD_FLATC is set to OFF, the flatbuffer compiler
and tests will not be build.

Change-Id: I42b87b71daab4cb9c06605c813e7e4b62d6bf67a
parent 352b743c
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,13 @@ project(FlatBuffers) ...@@ -6,6 +6,13 @@ project(FlatBuffers)
option(FLATBUFFERS_CODE_COVERAGE "Enable the code coverage build option." OFF) option(FLATBUFFERS_CODE_COVERAGE "Enable the code coverage build option." OFF)
option(FLATBUFFERS_BUILD_TESTS "Enable the build of tests and samples." ON) option(FLATBUFFERS_BUILD_TESTS "Enable the build of tests and samples." ON)
option(FLATBUFFERS_INSTALL "Enable the installation of targets." ON) option(FLATBUFFERS_INSTALL "Enable the installation of targets." ON)
option(FLATBUFFERS_BUILD_FLATC "Enable the build of the flatbuffers compiler" ON)
if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS)
message(WARNING
"Cannot build tests without building the compiler. Tests will be disabled.")
set(FLATBUFFERS_BUILD_TESTS OFF)
endif()
set(FlatBuffers_Compiler_SRCS set(FlatBuffers_Compiler_SRCS
include/flatbuffers/flatbuffers.h include/flatbuffers/flatbuffers.h
...@@ -69,7 +76,9 @@ endif() ...@@ -69,7 +76,9 @@ endif()
include_directories(include) include_directories(include)
if(FLATBUFFERS_BUILD_FLATC)
add_executable(flatc ${FlatBuffers_Compiler_SRCS}) add_executable(flatc ${FlatBuffers_Compiler_SRCS})
endif()
function(compile_flatbuffers_schema_to_cpp SRC_FBS) function(compile_flatbuffers_schema_to_cpp SRC_FBS)
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH) get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
...@@ -93,7 +102,9 @@ endif() ...@@ -93,7 +102,9 @@ endif()
if(FLATBUFFERS_INSTALL) if(FLATBUFFERS_INSTALL)
install(DIRECTORY include/flatbuffers DESTINATION include) install(DIRECTORY include/flatbuffers DESTINATION include)
install(TARGETS flatc DESTINATION bin) if(FLATBUFFERS_BUILD_FLATC)
install(TARGETS flatc DESTINATION bin)
endif()
endif() endif()
if(FLATBUFFERS_BUILD_TESTS) if(FLATBUFFERS_BUILD_TESTS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment