Add examples compilation

This commit is contained in:
sha512sum 2024-06-27 04:35:55 +00:00
parent 6bb8412e96
commit 32833faec2
3 changed files with 12 additions and 0 deletions

View file

@ -64,3 +64,15 @@ if(ENABLE_TESTS)
gtest_discover_tests(cserver_tests) gtest_discover_tests(cserver_tests)
endif() endif()
if(ENABLE_EXAMPLES)
file(GLOB EXAMPLES_SRC "examples/src/*.cpp")
foreach(EXAMPLE_SRC ${EXAMPLES_SRC})
get_filename_component(EXAMPLE_NAME ${EXAMPLE_SRC} NAME_WE)
add_executable(${EXAMPLE_NAME} ${EXAMPLE_SRC})
target_link_libraries(${EXAMPLE_NAME} cserver)
set_property(TARGET ${EXAMPLE_NAME} PROPERTY CXX_STANDARD 23)
set_target_properties(${EXAMPLE_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/examples/output/")
endforeach()
endif()

BIN
examples/output/http Executable file

Binary file not shown.