|
7 | 7 | include_directories(${CPP-NETLIB_SOURCE_DIR})
|
8 | 8 | find_package( Boost 1.45.0 REQUIRED unit_test_framework system regex thread filesystem )
|
9 | 9 | find_package( OpenSSL )
|
| 10 | +find_package( PythonInterp ) |
10 | 11 |
|
11 | 12 | if (OPENSSL_FOUND)
|
12 | 13 | include_directories( ${OPENSSL_INCLUDE_DIR} )
|
@@ -60,31 +61,36 @@ if (Boost_FOUND)
|
60 | 61 | ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test})
|
61 | 62 | endforeach (test)
|
62 | 63 |
|
63 |
| - set ( SERVER_TESTS |
| 64 | + if ( PYTHONINTERP_FOUND ) |
| 65 | + set ( SERVER_TESTS |
64 | 66 | server_hello_world
|
65 | 67 | server_async
|
66 | 68 | server_async_less_copy
|
67 | 69 | )
|
68 |
| - set ( PORT 8000 ) |
69 |
| - foreach ( test ${SERVER_TESTS} ) |
| 70 | + set ( PORT 8000 ) |
| 71 | + foreach ( test ${SERVER_TESTS} ) |
70 | 72 | if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
|
71 |
| - set_source_files_properties(${test}.cpp |
72 |
| - PROPERTIES COMPILE_FLAGS "-Wall") |
| 73 | + set_source_files_properties(${test}.cpp |
| 74 | + PROPERTIES COMPILE_FLAGS "-Wall") |
73 | 75 | endif()
|
74 | 76 | add_executable(cpp-netlib-http-${test} ${test}.cpp)
|
75 | 77 | add_dependencies(cpp-netlib-http-${test} cppnetlib-server-parsers)
|
76 | 78 | target_link_libraries(cpp-netlib-http-${test} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-server-parsers)
|
77 | 79 | set_target_properties(cpp-netlib-http-${test}
|
78 |
| - PROPERTIES RUNTIME_OUTPUT_DIRECTORY |
79 |
| - ${CPP-NETLIB_BINARY_DIR}/tests) |
| 80 | + PROPERTIES RUNTIME_OUTPUT_DIRECTORY |
| 81 | + ${CPP-NETLIB_BINARY_DIR}/tests) |
80 | 82 | add_test(cpp-netlib-${test}
|
81 |
| - python |
82 |
| - ${CPP-NETLIB_SOURCE_DIR}/libs/network/test/httplib_acceptance.py |
83 |
| - ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test} |
84 |
| - ${PORT} |
85 |
| - ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test}.passed) |
| 83 | + ${PYTHON_EXECUTABLE} |
| 84 | + ${CPP-NETLIB_SOURCE_DIR}/libs/network/test/httplib_acceptance.py |
| 85 | + ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test} |
| 86 | + ${PORT} |
| 87 | + ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test}.passed) |
86 | 88 | math (EXPR PORT "${PORT} + 1")
|
87 |
| - endforeach (test) |
| 89 | + endforeach (test) |
| 90 | + #else() |
| 91 | + # message(STATUS "Python not found, won't run server tests." |
| 92 | + endif( PYTHONINTERP_FOUND ) |
| 93 | + |
88 | 94 |
|
89 | 95 | #set ( INLINED_TESTS
|
90 | 96 | # client_include_inlined
|
|
0 commit comments