CMakeLists.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. cmake_minimum_required(VERSION 2.8)
  2. project (crow_examples)
  3. if (MSVC)
  4. add_executable(example_vs example_vs.cpp)
  5. target_link_libraries(example_vs ${Boost_LIBRARIES})
  6. target_link_libraries(example_vs ${CMAKE_THREAD_LIBS_INIT})
  7. else ()
  8. add_executable(helloworld helloworld.cpp)
  9. target_link_libraries(helloworld ${Boost_LIBRARIES})
  10. target_link_libraries(helloworld ${CMAKE_THREAD_LIBS_INIT})
  11. if (OPENSSL_FOUND)
  12. add_executable(example_ssl ssl/example_ssl.cpp)
  13. target_link_libraries(example_ssl ${Boost_LIBRARIES})
  14. target_link_libraries(example_ssl ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES})
  15. endif()
  16. add_executable(example_websocket websocket/example_ws.cpp)
  17. target_link_libraries(example_websocket ${Boost_LIBRARIES})
  18. target_link_libraries(example_websocket ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES})
  19. add_custom_command(OUTPUT ws.html
  20. COMMAND ${CMAKE_COMMAND} -E
  21. copy ${PROJECT_SOURCE_DIR}/websocket/templates/ws.html ${CMAKE_CURRENT_BINARY_DIR}/templates/ws.html
  22. DEPENDS ${PROJECT_SOURCE_DIR}/websocket/templates/ws.html
  23. )
  24. add_custom_target(example_ws_copy ALL DEPENDS ws.html)
  25. add_executable(example example.cpp)
  26. #target_link_libraries(example crow)
  27. target_link_libraries(example ${Boost_LIBRARIES})
  28. target_link_libraries(example ${CMAKE_THREAD_LIBS_INIT})
  29. if (Tcmalloc_FOUND)
  30. target_link_libraries(example ${Tcmalloc_LIBRARIES})
  31. endif(Tcmalloc_FOUND)
  32. add_executable(example_with_all example_with_all.cpp)
  33. add_dependencies(example_with_all amalgamation)
  34. #target_link_libraries(example crow)
  35. target_link_libraries(example_with_all ${Boost_LIBRARIES})
  36. target_link_libraries(example_with_all ${CMAKE_THREAD_LIBS_INIT})
  37. add_custom_command(OUTPUT example_test.py
  38. COMMAND ${CMAKE_COMMAND} -E
  39. copy ${PROJECT_SOURCE_DIR}/example_test.py ${CMAKE_CURRENT_BINARY_DIR}/example_test.py
  40. DEPENDS ${PROJECT_SOURCE_DIR}/example_test.py
  41. )
  42. add_custom_target(example_copy ALL DEPENDS example_test.py)
  43. add_executable(example_chat example_chat.cpp)
  44. target_link_libraries(example_chat ${Boost_LIBRARIES})
  45. target_link_libraries(example_chat ${CMAKE_THREAD_LIBS_INIT})
  46. add_custom_command(OUTPUT example_chat.html
  47. COMMAND ${CMAKE_COMMAND} -E
  48. copy ${PROJECT_SOURCE_DIR}/example_chat.html ${CMAKE_CURRENT_BINARY_DIR}/example_chat.html
  49. DEPENDS ${PROJECT_SOURCE_DIR}/example_chat.html
  50. )
  51. add_custom_target(example_chat_copy ALL DEPENDS example_chat.html)
  52. #SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pg" )
  53. #SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g -pg" )
  54. endif()