2020-10-18 16:59:15 +00:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2021-08-23 20:30:39 +00:00
|
|
|
project(crow_examples)
|
2015-02-20 20:46:28 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/compiler_options.cmake)
|
2021-01-08 15:13:39 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
add_executable(helloworld helloworld.cpp)
|
|
|
|
add_warnings_optimizations(helloworld)
|
|
|
|
target_link_libraries(helloworld PUBLIC Crow::Crow)
|
2021-01-02 19:12:04 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
# If compression is enabled, the example will be built
|
|
|
|
if(CROW_ENABLE_COMPRESSION)
|
2021-01-21 03:56:02 +00:00
|
|
|
add_executable(example_compression example_compression.cpp)
|
2021-08-23 20:30:39 +00:00
|
|
|
add_warnings_optimizations(example_compression)
|
|
|
|
target_link_libraries(example_compression Crow::Crow)
|
|
|
|
else()
|
|
|
|
message(STATUS "example_compression example deactivated")
|
|
|
|
endif()
|
2015-06-10 06:53:58 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
# If SSL is enabled, the example will be built
|
|
|
|
if(CROW_ENABLE_SSL)
|
|
|
|
add_executable(example_ssl ssl/example_ssl.cpp)
|
|
|
|
add_warnings_optimizations(example_ssl)
|
|
|
|
target_link_libraries(example_ssl PUBLIC Crow::Crow)
|
|
|
|
else()
|
|
|
|
message(STATUS "example_ssl example deactivated")
|
|
|
|
endif()
|
2015-09-20 13:06:00 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
add_executable(example_websocket websocket/example_ws.cpp)
|
|
|
|
add_warnings_optimizations(example_websocket)
|
|
|
|
target_link_libraries(example_websocket PUBLIC Crow::Crow)
|
|
|
|
add_custom_command(OUTPUT ws.html
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E
|
|
|
|
copy ${PROJECT_SOURCE_DIR}/websocket/templates/ws.html ${CMAKE_CURRENT_BINARY_DIR}/templates/ws.html
|
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/websocket/templates/ws.html
|
|
|
|
)
|
|
|
|
add_custom_target(example_ws_copy ALL DEPENDS ws.html)
|
2016-08-28 05:46:31 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
add_executable(basic_example example.cpp)
|
|
|
|
add_warnings_optimizations(basic_example)
|
|
|
|
target_link_libraries(basic_example PUBLIC Crow::Crow)
|
|
|
|
add_custom_command(OUTPUT example_test.py
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E
|
|
|
|
copy ${PROJECT_SOURCE_DIR}/example_test.py ${CMAKE_CURRENT_BINARY_DIR}/example_test.py
|
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/example_test.py
|
|
|
|
)
|
|
|
|
add_custom_target(example_copy ALL DEPENDS example_test.py)
|
2014-08-14 23:22:02 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
if(CROW_AMALGAMATE)
|
2021-01-08 15:13:39 +00:00
|
|
|
add_executable(example_with_all example_with_all.cpp)
|
2021-08-23 20:30:39 +00:00
|
|
|
add_dependencies(example_with_all crow_amalgamated)
|
|
|
|
add_warnings_optimizations(example_with_all)
|
|
|
|
target_include_directories(example_with_all PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
endif()
|
2014-10-23 16:20:19 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
add_executable(example_chat example_chat.cpp)
|
|
|
|
add_warnings_optimizations(example_chat)
|
|
|
|
target_link_libraries(example_chat PUBLIC Crow::Crow)
|
|
|
|
add_custom_command(OUTPUT example_chat.html
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E
|
|
|
|
copy ${PROJECT_SOURCE_DIR}/example_chat.html ${CMAKE_CURRENT_BINARY_DIR}/example_chat.html
|
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/example_chat.html
|
|
|
|
)
|
|
|
|
add_custom_target(example_chat_copy ALL DEPENDS example_chat.html)
|
2014-08-06 16:18:33 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
add_executable(example_static_file example_static_file.cpp)
|
|
|
|
add_warnings_optimizations(example_static_file)
|
|
|
|
target_link_libraries(example_static_file PUBLIC Crow::Crow)
|
2021-07-05 09:18:00 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
add_executable(example_catchall example_catchall.cpp)
|
|
|
|
add_warnings_optimizations(example_catchall)
|
|
|
|
target_link_libraries(example_catchall PUBLIC Crow::Crow)
|
2021-04-12 05:25:09 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
add_executable(example_json_map example_json_map.cpp)
|
|
|
|
add_warnings_optimizations(example_json_map)
|
|
|
|
target_link_libraries(example_json_map PUBLIC Crow::Crow)
|
2021-07-05 09:14:31 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
add_executable(example_blueprint example_blueprint.cpp)
|
|
|
|
add_warnings_optimizations(example_blueprint)
|
|
|
|
target_link_libraries(example_blueprint PUBLIC Crow::Crow)
|
2014-08-14 23:22:02 +00:00
|
|
|
|
2021-08-23 20:30:39 +00:00
|
|
|
if(MSVC)
|
|
|
|
add_executable(example_vs example_vs.cpp)
|
|
|
|
add_warnings_optimizations(example_vs)
|
|
|
|
target_link_libraries(example_vs Crow::Crow)
|
2015-02-20 20:46:28 +00:00
|
|
|
endif()
|