diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-07-16 02:03:33 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-07-16 02:03:33 +0200 |
commit | 5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 (patch) | |
tree | cb21506e7b04d10b45d6066a0ee1655563d5d52b /test/monster_test_cpp/CMakeLists.txt |
Squashed 'flatcc/' content from commit 473da2a
git-subtree-dir: flatcc
git-subtree-split: 473da2afa5ca435363f8c5e6569167aee6bc31c5
Diffstat (limited to 'test/monster_test_cpp/CMakeLists.txt')
-rw-r--r-- | test/monster_test_cpp/CMakeLists.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/monster_test_cpp/CMakeLists.txt b/test/monster_test_cpp/CMakeLists.txt new file mode 100644 index 0000000..dd576ca --- /dev/null +++ b/test/monster_test_cpp/CMakeLists.txt @@ -0,0 +1,24 @@ +include(CTest) + +# Note: This re-uses the samples/monster fbs and .c file. + +set(INC_DIR "${PROJECT_SOURCE_DIR}/include") +# We use our own separate gen dir so we don't clash with the real monster sample. +set(GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated/monster_test_cpp") +set(FBS_DIR "${PROJECT_SOURCE_DIR}/samples/monster") + +include_directories("${GEN_DIR}" "${INC_DIR}") + +add_custom_target(gen_monster_test_cpp ALL) +add_custom_command ( + TARGET gen_monster_test_cpp + COMMAND ${CMAKE_COMMAND} -E make_directory "${GEN_DIR}" + COMMAND flatcc_cli -a -o "${GEN_DIR}" "${FBS_DIR}/monster.fbs" + DEPENDS flatcc_cli "${FBS_DIR}/monster.fbs" +) + +add_executable(monster_test_cpp monster_test.cpp) +add_dependencies(monster_test_cpp gen_monster_test_cpp) +target_link_libraries(monster_test_cpp flatccrt) + +add_test(monster_test_cpp monster_test_cpp${CMAKE_EXECUTABLE_SUFFIX}) |