comparison OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake @ 4210:7b14ddf795c5

auto-detection of mg_disable_keep_alive() in CMake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Sep 2020 11:20:08 +0200
parents 304842a0d152
children c8c0bbaaace3
comparison
equal deleted inserted replaced
4209:c3fc0b884442 4210:7b14ddf795c5
91 ) 91 )
92 92
93 else() 93 else()
94 CHECK_INCLUDE_FILE_CXX(civetweb.h HAVE_CIVETWEB_H) 94 CHECK_INCLUDE_FILE_CXX(civetweb.h HAVE_CIVETWEB_H)
95 if (NOT HAVE_CIVETWEB_H) 95 if (NOT HAVE_CIVETWEB_H)
96 message(FATAL_ERROR "Please install the libcivetweb-devel package") 96 message(FATAL_ERROR "Please install the libcivetweb-dev package")
97 endif() 97 endif()
98 98
99 cmake_reset_check_state() 99 cmake_reset_check_state()
100 set(CMAKE_REQUIRED_LIBRARIES dl pthread) 100 set(CMAKE_REQUIRED_LIBRARIES dl pthread)
101 CHECK_LIBRARY_EXISTS(civetweb mg_start "" HAVE_CIVETWEB_LIB) 101 CHECK_LIBRARY_EXISTS(civetweb mg_start "" HAVE_CIVETWEB_LIB)
102 if (NOT HAVE_CIVETWEB_LIB) 102 if (NOT HAVE_CIVETWEB_LIB)
103 message(FATAL_ERROR "Please install the libcivetweb-devel package") 103 message(FATAL_ERROR "Please install the libcivetweb-dev package")
104 endif() 104 endif()
105 105
106 link_libraries(civetweb) 106 link_libraries(civetweb)
107 unset(CMAKE_REQUIRED_LIBRARIES) 107 unset(CMAKE_REQUIRED_LIBRARIES)
108 108
109 add_definitions( 109 # Check whether the system distribution of civetweb contains the
110 -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0 110 # patch "../Patches/civetweb-1.12.patch" that allows to disable
111 ) 111 # keep-alive on selected HTTP connections. This is useful to speed
112 # up multipart transfers, as encountered in DICOMweb.
113 CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE)
114 if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE)
115 add_definitions(-DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1)
116 message("Performance: Your system-wide distribution of civetweb is configured for best performance")
117 else()
118 message(WARNING "Performance: Your system-wide distribution of civetweb does not feature the mg_disable_keep_alive() function")
119 add_definitions(-DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0)
120 endif()
112 endif() 121 endif()