diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ef65f026c..fac0abbf4 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -19,7 +19,13 @@ endif() add_executable(example_websocket websocket/example_ws.cpp) target_link_libraries(example_websocket ${Boost_LIBRARIES}) -target_link_libraries(example_websocket ${CMAKE_THREAD_LIBS_INIT} ssl crypto) +target_link_libraries(example_websocket ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES}) +add_custom_command(OUTPUT ws.html + COMMAND ${CMAKE_COMMAND} -E + copy ${PROJECT_SOURCE_DIR}/websocket/templates/ws.html ${CMAKE_CURRENT_BINARY_DIR}/ws.html + DEPENDS ${PROJECT_SOURCE_DIR}/websocket/templates/ws.html + ) +add_custom_target(example_ws_copy ALL DEPENDS ws.html) add_executable(example example.cpp) #target_link_libraries(example crow) diff --git a/examples/websocket/example_ws.cpp b/examples/websocket/example_ws.cpp index e3c1b8590..173d06239 100644 --- a/examples/websocket/example_ws.cpp +++ b/examples/websocket/example_ws.cpp @@ -33,10 +33,10 @@ int main() CROW_ROUTE(app, "/") ([]{ - char name[256]; - gethostname(name, 256); - crow::mustache::context x; - x["servername"] = name; + char name[256]; + gethostname(name, 256); + crow::mustache::context x; + x["servername"] = name; auto page = crow::mustache::load("ws.html"); return page.render(x); diff --git a/examples/websocket/templates/ws.html b/examples/websocket/templates/ws.html index 5200b8b63..2d38fdfce 100644 --- a/examples/websocket/templates/ws.html +++ b/examples/websocket/templates/ws.html @@ -12,6 +12,7 @@