Added
Link Here
|
1 |
--- OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake.orig 2021-05-12 13:54:35 UTC |
2 |
+++ OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake |
3 |
@@ -98,32 +98,38 @@ else() |
4 |
|
5 |
cmake_reset_check_state() |
6 |
set(CMAKE_REQUIRED_LIBRARIES dl pthread) |
7 |
- CHECK_LIBRARY_EXISTS(civetweb mg_start "" HAVE_CIVETWEB_LIB) |
8 |
- if (NOT HAVE_CIVETWEB_LIB) |
9 |
- message(FATAL_ERROR "Please install the libcivetweb-dev package") |
10 |
- endif() |
11 |
|
12 |
- link_libraries(civetweb) |
13 |
+ find_library(CIVETWEB_LIB NAMES civetweb PATHS |
14 |
+ /usr/lib |
15 |
+ /usr/local/lib |
16 |
+ ) |
17 |
|
18 |
- # Check whether the system distribution of civetweb contains the |
19 |
- # patch "../Patches/civetweb-1.13.patch" that allows to disable |
20 |
- # keep-alive on selected HTTP connections. This is useful to speed |
21 |
- # up multipart transfers, as encountered in DICOMweb. |
22 |
- CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1) # From "../Patches/civetweb-1.13.patch" |
23 |
- CHECK_LIBRARY_EXISTS(civetweb mg_disable_connection_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2) # From civetweb >= 1.14 |
24 |
- if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1 OR |
25 |
- CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2) |
26 |
- add_definitions( |
27 |
- -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1 |
28 |
- -DCIVETWEB_HAS_WEBDAV_WRITING=1 |
29 |
- ) |
30 |
- message("Performance: Your system-wide distribution of civetweb is configured for best performance") |
31 |
+ if (CIVETWEB_LIB) |
32 |
+ CHECK_LIBRARY_EXISTS(${CIVETWEB_LIB} mg_start "" HAVE_CIVETWEB_LIB) |
33 |
+ if (NOT HAVE_CIVETWEB_LIB) |
34 |
+ message(FATAL_ERROR "Unable to use mg_start from civetweb library") |
35 |
+ endif() |
36 |
+ |
37 |
+ CHECK_LIBRARY_EXISTS(${CIVETWEB_LIB} mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE) |
38 |
+ if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE) |
39 |
+ add_definitions( |
40 |
+ -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1 |
41 |
+ -DCIVETWEB_HAS_WEBDAV_WRITING=1 |
42 |
+ ) |
43 |
+ message("Performance: Your system-wide distribution of civetweb is configured for best performance") |
44 |
+ else() |
45 |
+ message(WARNING "Performance: Your system-wide distribution of civetweb does not feature the mg_disable_keep_alive() function, and WebDAV will only be available for read-only access") |
46 |
+ add_definitions( |
47 |
+ -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0 |
48 |
+ -DCIVETWEB_HAS_WEBDAV_WRITING=0 |
49 |
+ ) |
50 |
+ endif() |
51 |
+ |
52 |
+ get_filename_component(CIVETWEB_LIB_PATH ${CIVETWEB_LIB} DIRECTORY) |
53 |
+ link_directories(${CIVETWEB_LIB_PATH}) |
54 |
+ link_libraries(civetweb) |
55 |
else() |
56 |
- message(WARNING "Performance: Your system-wide distribution of civetweb does not feature the mg_disable_keep_alive() function, and WebDAV will only be available for read-only access") |
57 |
- add_definitions( |
58 |
- -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0 |
59 |
- -DCIVETWEB_HAS_WEBDAV_WRITING=0 |
60 |
- ) |
61 |
+ message(FATAL_ERROR "Unable to find the civetweb library") |
62 |
endif() |
63 |
|
64 |
unset(CMAKE_REQUIRED_LIBRARIES) # This reset must be after "CHECK_LIBRARY_EXISTS" |