summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorsvenk177 <50141814+svenk177@users.noreply.github.com>2019-06-18 00:15:13 +0200
committerWouter van Oortmerssen <aardappel@gmail.com>2019-06-18 00:15:13 +0200
commite635141d5bc66f056c90bcc9da5fdd766610492f (patch)
treeb69da4d3b4d2e6e592083a2c31c6d7f809666575 /CMakeLists.txt
parent0d2cebccfeffae9df998f3ac819bf17b7ec7a6d0 (diff)
downloadflatbuffers-e635141d5bc66f056c90bcc9da5fdd766610492f.tar.gz
flatbuffers-e635141d5bc66f056c90bcc9da5fdd766610492f.tar.bz2
flatbuffers-e635141d5bc66f056c90bcc9da5fdd766610492f.zip
Add support for fixed-size arrays (#5313)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt11
1 files changed, 9 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30be238f..c7da97f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,6 +119,8 @@ set(FlatBuffers_Tests_SRCS
tests/test_builder.cpp
# file generate by running compiler on tests/monster_test.fbs
${CMAKE_CURRENT_BINARY_DIR}/tests/monster_test_generated.h
+ # file generate by running compiler on tests/arrays_test.fbs
+ ${CMAKE_CURRENT_BINARY_DIR}/tests/arrays_test_generated.h
)
set(FlatBuffers_Sample_Binary_SRCS
@@ -303,7 +305,7 @@ if(FLATBUFFERS_BUILD_SHAREDLIB)
VERSION "${FlatBuffers_Library_SONAME_FULL}")
endif()
-function(compile_flatbuffers_schema_to_cpp SRC_FBS)
+function(compile_flatbuffers_schema_to_cpp_opt SRC_FBS OPT)
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
string(REGEX REPLACE "\\.fbs$" "_generated.h" GEN_HEADER ${SRC_FBS})
add_custom_command(
@@ -311,12 +313,16 @@ function(compile_flatbuffers_schema_to_cpp SRC_FBS)
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -c --no-includes --gen-mutable
--gen-object-api --gen-compare -o "${SRC_FBS_DIR}"
--cpp-ptr-type flatbuffers::unique_ptr # Used to test with C++98 STLs
- --reflect-names
+ --reflect-names ${OPT}
-I "${CMAKE_CURRENT_SOURCE_DIR}/tests/include_test"
"${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FBS}"
DEPENDS flatc)
endfunction()
+function(compile_flatbuffers_schema_to_cpp SRC_FBS)
+ compile_flatbuffers_schema_to_cpp_opt(${SRC_FBS} "")
+endfunction()
+
function(compile_flatbuffers_schema_to_binary SRC_FBS)
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
string(REGEX REPLACE "\\.fbs$" ".bfbs" GEN_BINARY_SCHEMA ${SRC_FBS})
@@ -329,6 +335,7 @@ endfunction()
if(FLATBUFFERS_BUILD_TESTS)
compile_flatbuffers_schema_to_cpp(tests/monster_test.fbs)
+ compile_flatbuffers_schema_to_cpp_opt(tests/arrays_test.fbs --scoped-enums)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/tests)
add_executable(flattests ${FlatBuffers_Tests_SRCS})
set_property(TARGET flattests