CMakeLists.txt (670B)
1 include(CTest) 2 3 set(INC_DIR "${PROJECT_SOURCE_DIR}/include") 4 set(GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") 5 set(FBS_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 6 7 include_directories("${GEN_DIR}" "${INC_DIR}") 8 9 add_custom_target(gen_monster_fbs ALL) 10 add_custom_command ( 11 TARGET gen_monster_fbs 12 COMMAND ${CMAKE_COMMAND} -E make_directory "${GEN_DIR}" 13 COMMAND flatcc_cli -a -o "${GEN_DIR}" "${FBS_DIR}/monster.fbs" 14 DEPENDS flatcc_cli "${FBS_DIR}/monster.fbs" 15 ) 16 add_executable(monster monster.c) 17 add_dependencies(monster gen_monster_fbs) 18 target_link_libraries(monster flatccrt) 19 20 if (FLATCC_TEST) 21 add_test(monster monster${CMAKE_EXECUTABLE_SUFFIX}) 22 endif()