2020-10-18 16:59:15 +00:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2014-08-06 16:18:33 +00:00
|
|
|
project (crow_examples)
|
2015-02-20 20:46:28 +00:00
|
|
|
|
2021-01-08 15:13:39 +00:00
|
|
|
# Define Required libraries
|
|
|
|
list(APPEND REQUIRED_LIBRARIES
|
|
|
|
${Boost_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
2021-01-21 18:36:41 +00:00
|
|
|
z
|
2021-01-08 15:13:39 +00:00
|
|
|
)
|
|
|
|
|
2015-02-20 20:46:28 +00:00
|
|
|
if (MSVC)
|
2020-10-19 08:02:57 +00:00
|
|
|
add_executable(example_vs example_vs.cpp)
|
2021-01-11 05:59:32 +00:00
|
|
|
target_compile_options(example_vs PRIVATE "${compiler_options}")
|
2021-01-08 15:13:39 +00:00
|
|
|
target_link_libraries(example_vs )
|
2015-02-20 20:46:28 +00:00
|
|
|
else ()
|
2020-10-19 08:02:57 +00:00
|
|
|
add_executable(helloworld helloworld.cpp)
|
2021-01-11 05:59:32 +00:00
|
|
|
target_compile_options(helloworld PRIVATE "${compiler_options}")
|
2021-01-08 15:13:39 +00:00
|
|
|
target_link_libraries(helloworld PUBLIC ${REQUIRED_LIBRARIES})
|
2021-01-02 19:12:04 +00:00
|
|
|
|
2021-01-21 03:56:02 +00:00
|
|
|
add_executable(example_compression example_compression.cpp)
|
|
|
|
target_compile_options(example_compression PRIVATE "${compiler_options}")
|
2021-01-21 18:36:41 +00:00
|
|
|
target_link_libraries(example_compression ${REQUIRED_LIBRARIES})
|
2021-01-02 19:12:04 +00:00
|
|
|
|
2021-01-12 12:31:33 +00:00
|
|
|
# If OpenSSL is not found, the example won't be built
|
2021-01-08 15:13:39 +00:00
|
|
|
if (OPENSSL_FOUND)
|
|
|
|
add_executable(example_ssl ssl/example_ssl.cpp)
|
2021-01-11 05:59:32 +00:00
|
|
|
target_compile_options(example_ssl PRIVATE "${compiler_options}")
|
2021-01-08 15:13:39 +00:00
|
|
|
target_link_libraries(example_ssl PUBLIC ${REQUIRED_LIBRARIES} ${OPENSSL_LIBRARIES})
|
2021-01-14 05:19:15 +00:00
|
|
|
else()
|
|
|
|
message(STATUS "example_ssl Example deactivated - OpenSSL was not found")
|
2021-01-08 15:13:39 +00:00
|
|
|
endif()
|
2015-06-10 06:53:58 +00:00
|
|
|
|
2021-01-08 15:13:39 +00:00
|
|
|
add_executable(example_websocket websocket/example_ws.cpp)
|
2021-01-11 05:59:32 +00:00
|
|
|
target_compile_options(example_websocket PRIVATE "${compiler_options}")
|
2021-01-08 15:13:39 +00:00
|
|
|
target_link_libraries(example_websocket )
|
|
|
|
target_link_libraries(example_websocket PUBLIC ${REQUIRED_LIBRARIES})
|
|
|
|
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)
|
2015-09-20 13:06:00 +00:00
|
|
|
|
2021-01-08 15:13:39 +00:00
|
|
|
add_executable(basic_example example.cpp)
|
2021-01-11 05:59:32 +00:00
|
|
|
target_compile_options(basic_example PRIVATE "${compiler_options}")
|
2021-01-08 15:13:39 +00:00
|
|
|
target_link_libraries(basic_example PUBLIC ${REQUIRED_LIBRARIES})
|
2016-08-28 05:46:31 +00:00
|
|
|
|
2021-01-08 15:13:39 +00:00
|
|
|
if (Tcmalloc_FOUND)
|
2021-04-06 11:17:51 +00:00
|
|
|
target_link_libraries(basic_example PRIVATE ${Tcmalloc_LIBRARIES})
|
2021-01-08 15:13:39 +00:00
|
|
|
endif(Tcmalloc_FOUND)
|
2014-08-14 23:22:02 +00:00
|
|
|
|
2021-01-08 15:13:39 +00:00
|
|
|
add_executable(example_with_all example_with_all.cpp)
|
|
|
|
add_dependencies(example_with_all amalgamation)
|
2021-01-11 05:59:32 +00:00
|
|
|
target_compile_options(example_with_all PRIVATE "${compiler_options}")
|
2021-01-08 15:13:39 +00:00
|
|
|
target_link_libraries(example_with_all PUBLIC ${REQUIRED_LIBRARIES})
|
2014-08-14 23:22:02 +00:00
|
|
|
|
2021-01-08 15:13:39 +00:00
|
|
|
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-10-23 16:20:19 +00:00
|
|
|
|
2021-01-08 15:13:39 +00:00
|
|
|
add_executable(example_chat example_chat.cpp)
|
2021-01-11 05:59:32 +00:00
|
|
|
target_compile_options(example_chat PRIVATE "${compiler_options}")
|
2021-01-08 15:13:39 +00:00
|
|
|
target_link_libraries(example_chat PUBLIC ${REQUIRED_LIBRARIES})
|
2014-08-06 16:18:33 +00:00
|
|
|
|
2021-04-12 05:25:09 +00:00
|
|
|
add_executable(example_catchall example_catchall.cpp)
|
|
|
|
target_compile_options(example_catchall PRIVATE "${compiler_options}")
|
|
|
|
target_link_libraries(example_catchall PUBLIC ${REQUIRED_LIBRARIES})
|
2021-05-12 12:45:55 +00:00
|
|
|
|
|
|
|
add_executable(example_json_map example_json_map.cpp)
|
|
|
|
target_compile_options(example_json_map PRIVATE "${compiler_options}")
|
|
|
|
target_link_libraries(example_json_map PUBLIC ${REQUIRED_LIBRARIES})
|
2021-04-12 05:25:09 +00:00
|
|
|
|
2021-01-08 15:13:39 +00:00
|
|
|
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-14 23:22:02 +00:00
|
|
|
|
2015-02-20 20:46:28 +00:00
|
|
|
endif()
|