diff --git a/CMakeLists.txt b/CMakeLists.txt index ae04bb1..25eb3b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,3 +64,15 @@ if(ENABLE_TESTS) gtest_discover_tests(cserver_tests) 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() + diff --git a/examples/output/http b/examples/output/http new file mode 100755 index 0000000..c94ed29 Binary files /dev/null and b/examples/output/http differ diff --git a/examples/http.cpp b/examples/src/http.cpp similarity index 100% rename from examples/http.cpp rename to examples/src/http.cpp