CMakeLists.txt for the json example

This commit is contained in:
Robin Jadoul 2017-01-21 11:05:25 +01:00
parent 3a646f03e3
commit da924145ac
3 changed files with 22 additions and 1 deletions

View File

@ -129,9 +129,10 @@ endif()
include_directories(include) include_directories(include)
add_subdirectory(src) add_subdirectory(src)
add_dependencies(Parsodus ext-optparse)
enable_testing() enable_testing()
add_subdirectory(tests) add_subdirectory(tests)
add_dependencies(Parsodus ext-optparse) add_subdirectory(examples)
install(DIRECTORY templates install(DIRECTORY templates
DESTINATION share/Parsodus DESTINATION share/Parsodus

1
examples/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_subdirectory(json)

View File

@ -0,0 +1,19 @@
add_custom_command(DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/JSONLexer.lxs"
COMMAND "${LEXESIS_EXE}" ARGS -d "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/JSONLexer.lxs"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/JSONLexer.h" "${CMAKE_CURRENT_BINARY_DIR}/JSONLexer.cpp")
find_program(PARSODUS_EXE Parsodus PATH "${CMAKE_CURRENT_BINARY_DIR}/../../bin")
add_custom_command(DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/JSONParser.pds"
COMMAND "${PARSODUS_EXE}" ARGS -d "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/JSONParser.pds"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/JSONParser.h" "${CMAKE_CURRENT_BINARY_DIR}/JSONParser.cpp")
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
add_executable(json
EXCLUDE_FROM_ALL
json.cpp
main.cpp
parser.cpp
"${CMAKE_CURRENT_BINARY_DIR}/JSONLexer.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/JSONParser.cpp")