2021-05-20 19:03:35 +00:00
|
|
|
cmake_minimum_required(VERSION 3.14)
|
2021-02-02 16:45:59 +00:00
|
|
|
|
|
|
|
project(Examples LANGUAGES CXX)
|
|
|
|
|
2021-05-20 19:03:35 +00:00
|
|
|
include(../cmake/project-is-top-level.cmake)
|
|
|
|
|
|
|
|
if(PROJECT_IS_TOP_LEVEL)
|
|
|
|
find_package(tomlplusplus REQUIRED)
|
2021-02-02 16:45:59 +00:00
|
|
|
endif()
|
|
|
|
|
2021-05-20 19:03:35 +00:00
|
|
|
add_custom_target(run_examples COMMENT "Running all examples")
|
|
|
|
|
|
|
|
function(add_example name)
|
|
|
|
cmake_parse_arguments(PARSE_ARGV 1 "" "" "" ARGS)
|
|
|
|
add_executable("${name}" "${name}.cpp")
|
|
|
|
target_link_libraries("${name}" PRIVATE tomlplusplus::tomlplusplus)
|
|
|
|
target_compile_features("${name}" PRIVATE cxx_std_17)
|
|
|
|
add_custom_target("run_${name}" COMMAND "${name}" ${_ARGS} VERBATIM)
|
|
|
|
add_dependencies(run_examples "run_${name}")
|
|
|
|
endfunction()
|
2021-02-02 16:45:59 +00:00
|
|
|
|
2021-05-20 19:03:35 +00:00
|
|
|
add_example(error_printer)
|
2021-11-04 09:56:03 +00:00
|
|
|
add_example(parse_benchmark)
|
2022-05-20 14:54:58 +00:00
|
|
|
add_example(simple_parser)
|
|
|
|
add_example(toml_generator)
|
|
|
|
add_example(toml_merger)
|
2021-05-20 19:03:35 +00:00
|
|
|
add_example(toml_to_json_transcoder ARGS "${PROJECT_SOURCE_DIR}/example.toml")
|