|
4 | 4 | # http://www.boost.org/LICENSE_1_0.txt) |
5 | 5 |
|
6 | 6 | include_directories(${CPP-NETLIB_SOURCE_DIR}) |
7 | | -find_package( Boost 1.45.0 COMPONENTS program_options system regex date_time thread filesystem ) |
8 | | -find_package( OpenSSL ) |
9 | | -find_package( Threads ) |
10 | | - |
11 | | -if (Boost_FOUND) |
12 | | - set(Boost_USE_STATIC_LIBS ON) |
13 | | - set(Boost_USE_MULTITHREADED ON) |
14 | | -endif (Boost_FOUND) |
15 | | - |
16 | 7 | if (OPENSSL_FOUND) |
17 | 8 | include_directories(${OPENSSL_INCLUDE_DIR}) |
18 | 9 | endif (OPENSSL_FOUND) |
19 | 10 |
|
20 | | -if (Boost_FOUND) |
21 | | - add_executable(http_client http_client.cpp) |
22 | | - add_dependencies(http_client cppnetlib-uri) |
23 | | - target_link_libraries(http_client ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri cppnetlib-client-connections) |
24 | | - set_target_properties(http_client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
25 | | - if (OPENSSL_FOUND) |
26 | | - target_link_libraries(http_client ${OPENSSL_LIBRARIES}) |
27 | | - endif (OPENSSL_FOUND) |
28 | | - |
29 | | - add_executable(simple_wget simple_wget.cpp) |
30 | | - add_dependencies(simple_wget cppnetlib-uri) |
31 | | - target_link_libraries(simple_wget ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri cppnetlib-client-connections) |
32 | | - set_target_properties(simple_wget PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
33 | | - if (OPENSSL_FOUND) |
34 | | - target_link_libraries(simple_wget ${OPENSSL_LIBRARIES}) |
35 | | - endif (OPENSSL_FOUND) |
36 | | - |
37 | | - add_executable(one_liner http/one_liner.cpp) |
38 | | - target_link_libraries(one_liner ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri cppnetlib-client-connections) |
39 | | - set_target_properties(one_liner PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
40 | | - if (OPENSSL_FOUND) |
41 | | - target_link_libraries(one_liner ${OPENSSL_LIBRARIES}) |
42 | | - endif (OPENSSL_FOUND) |
43 | | - |
44 | | - add_executable(hello_world_server http/hello_world_server.cpp) |
45 | | - target_link_libraries(hello_world_server ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) |
46 | | - set_target_properties(hello_world_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
| 11 | +add_executable(http_client http_client.cpp) |
| 12 | +add_executable(simple_wget simple_wget.cpp) |
| 13 | +add_executable(hello_world_server http/hello_world_server.cpp) |
| 14 | +add_executable(fileserver http/fileserver.cpp) |
| 15 | +add_executable(uri uri.cpp) |
| 16 | +add_dependencies(http_client cppnetlib-uri cppnetlib-client-connections) |
| 17 | +add_dependencies(simple_wget cppnetlib-uri cppnetlib-client-connections) |
| 18 | +add_dependencies(uri cppnetlib-uri) |
| 19 | +set(BOOST_CLIENT_LIBS |
| 20 | + ${Boost_PROGRAM_OPTIONS_LIBRARY} |
| 21 | + ${Boost_THREAD_LIBRARY} |
| 22 | + ${Boost_SYSTEM_LIBRARY}) |
| 23 | + |
| 24 | +set(BOOST_SERVER_LIBS |
| 25 | + ${Boost_THREAD_LIBRARY} |
| 26 | + ${Boost_SYSTEM_LIBRARY} |
| 27 | + ${Boost_PROGRAM_OPTIONS_LIBRARY}) |
| 28 | + |
| 29 | +target_link_libraries(http_client |
| 30 | + ${BOOST_CLIENT_LIBS} |
| 31 | + ${CMAKE_THREAD_LIBS_INIT} |
| 32 | + cppnetlib-uri |
| 33 | + cppnetlib-client-connections) |
| 34 | + |
| 35 | +target_link_libraries(simple_wget |
| 36 | + ${BOOST_CLIENT_LIBS} |
| 37 | + ${CMAKE_THREAD_LIBS_INIT} |
| 38 | + cppnetlib-uri |
| 39 | + cppnetlib-client-connections) |
| 40 | + |
| 41 | +target_link_libraries(hello_world_server |
| 42 | + ${BOOST_SERVER_LIBS} |
| 43 | + ${CMAKE_THREAD_LIBS_INIT}) |
47 | 44 |
|
48 | | - if (UNIX) |
49 | | - add_executable(fileserver http/fileserver.cpp) |
50 | | - target_link_libraries(fileserver ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-server-parsers) |
51 | | - set_target_properties(fileserver PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
52 | | - endif (UNIX) |
53 | | - |
54 | | - add_executable(uri uri.cpp) |
55 | | - add_dependencies(uri cppnetlib-uri) |
56 | | - target_link_libraries(uri cppnetlib-uri) |
57 | | - set_target_properties(uri PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
58 | | - |
59 | | - add_executable(uri_builder uri_builder.cpp) |
60 | | - add_dependencies(uri_builder cppnetlib-uri) |
61 | | - target_link_libraries(uri_builder cppnetlib-uri) |
62 | | - set_target_properties(uri_builder PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
| 45 | +if (OPENSSL_FOUND) |
| 46 | + target_link_libraries(http_client ${OPENSSL_LIBRARIES}) |
| 47 | + target_link_libraries(simple_wget ${OPENSSL_LIBRARIES}) |
| 48 | + target_link_libraries(hello_world_server ${OPENSSL_LIBRARIES}) |
| 49 | +endif (OPENSSL_FOUND) |
63 | 50 |
|
64 | | -endif() |
| 51 | +target_link_libraries(fileserver |
| 52 | + ${BOOST_SERVER_LIBS} |
| 53 | + ${Boost_FILESYSTEM_LIBRARY} |
| 54 | + ${CMAKE_THREAD_LIBS_INIT} |
| 55 | + cppnetlib-server-parsers) |
| 56 | + |
| 57 | +target_link_libraries(uri cppnetlib-uri) |
| 58 | +set_target_properties(http_client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
| 59 | +set_target_properties(simple_wget PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
| 60 | +set_target_properties(hello_world_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
| 61 | +set_target_properties(fileserver PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
| 62 | +set_target_properties(uri PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example) |
0 commit comments