Mercurial > hg > orthanc
annotate Resources/CMake/CivetwebConfiguration.cmake @ 3807:2f28c7eb2776
fix civetweb 1.12 archive
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 02 Apr 2020 18:08:08 +0200 |
parents | 552703b37114 |
children |
rev | line source |
---|---|
2377
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 if (STATIC_BUILD OR NOT USE_SYSTEM_CIVETWEB) |
3807
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
2 |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
3 ## WARNING: "civetweb-1.12.tar.gz" comes with a subfolder |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
4 ## "civetweb-1.12/test/nonlatin" that cannot be removed by "hg purge |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
5 ## --all" on Windows hosts. We thus created a custom |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
6 ## "civetweb-1.12-fixed.tar.gz" as follows: |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
7 ## |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
8 ## $ cd /tmp |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
9 ## $ wget http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.12.tar.gz |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
10 ## $ tar xvf civetweb-1.12.tar.gz |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
11 ## $ rm -rf civetweb-1.12/src/third_party/ civetweb-1.12/test/ |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
12 ## $ tar cvfz civetweb-1.12-fixed.tar.gz civetweb-1.12 |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
13 ## |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
14 |
3801
9fe1d64a748c
upgrade to civetweb 1.12, error reporting if OpenSSL failure
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3688
diff
changeset
|
15 set(CIVETWEB_SOURCES_DIR ${CMAKE_BINARY_DIR}/civetweb-1.12) |
3807
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
16 set(CIVETWEB_URL "http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.12-fixed.tar.gz") |
2f28c7eb2776
fix civetweb 1.12 archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3804
diff
changeset
|
17 set(CIVETWEB_MD5 "016ed7cd26cbc46b5941f0cbfb2e4ac8") |
2377
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 |
3128
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
19 if (IS_DIRECTORY "${CIVETWEB_SOURCES_DIR}") |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
20 set(FirstRun OFF) |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
21 else() |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
22 set(FirstRun ON) |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
23 endif() |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
24 |
2377
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 DownloadPackage(${CIVETWEB_MD5} ${CIVETWEB_URL} "${CIVETWEB_SOURCES_DIR}") |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
3128
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
27 execute_process( |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
28 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i |
3801
9fe1d64a748c
upgrade to civetweb 1.12, error reporting if OpenSSL failure
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3688
diff
changeset
|
29 ${ORTHANC_ROOT}/Resources/Patches/civetweb-1.12.patch |
3128
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
30 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
31 RESULT_VARIABLE Failure |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
32 ) |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
33 |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
34 if (FirstRun AND Failure) |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
35 message(FATAL_ERROR "Error while patching a file") |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
36 endif() |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3068
diff
changeset
|
37 |
2377
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 include_directories( |
2378 | 39 ${CIVETWEB_SOURCES_DIR}/include |
2377
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 ) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 set(CIVETWEB_SOURCES |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 ${CIVETWEB_SOURCES_DIR}/src/civetweb.c |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 ) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
3688
9c091747483a
Enable support of compression in civetweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3178
diff
changeset
|
46 # New in Orthanc 1.6.0: Enable support of compression in civetweb |
9c091747483a
Enable support of compression in civetweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3178
diff
changeset
|
47 set_source_files_properties( |
9c091747483a
Enable support of compression in civetweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3178
diff
changeset
|
48 ${CIVETWEB_SOURCES} |
9c091747483a
Enable support of compression in civetweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3178
diff
changeset
|
49 PROPERTIES COMPILE_DEFINITIONS |
9c091747483a
Enable support of compression in civetweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3178
diff
changeset
|
50 "USE_ZLIB=1") |
9c091747483a
Enable support of compression in civetweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3178
diff
changeset
|
51 |
2377
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 if (ENABLE_SSL) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 add_definitions( |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 -DNO_SSL_DL=1 |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 ) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 link_libraries(dl) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 endif() |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 else() |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 add_definitions( |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 -DNO_SSL=1 # Remove SSL support from civetweb |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 ) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 endif() |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 source_group(ThirdParty\\Civetweb REGULAR_EXPRESSION ${CIVETWEB_SOURCES_DIR}/.*) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 |
3178
6d558598d713
Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
69 add_definitions( |
6d558598d713
Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
70 -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1 |
6d558598d713
Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
71 ) |
6d558598d713
Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
72 |
2377
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 else() |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 CHECK_INCLUDE_FILE_CXX(civetweb.h HAVE_CIVETWEB_H) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 if (NOT HAVE_CIVETWEB_H) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 message(FATAL_ERROR "Please install the libcivetweb-devel package") |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 endif() |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 cmake_reset_check_state() |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 set(CMAKE_REQUIRED_LIBRARIES dl pthread) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 CHECK_LIBRARY_EXISTS(civetweb mg_start "" HAVE_CIVETWEB_LIB) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 if (NOT HAVE_CIVETWEB_LIB) |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 message(FATAL_ERROR "Please install the libcivetweb-devel package") |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 endif() |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 |
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 link_libraries(civetweb) |
3178
6d558598d713
Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
87 |
6d558598d713
Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
88 add_definitions( |
6d558598d713
Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
89 -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0 |
6d558598d713
Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
90 ) |
2377
32bea64e070b
Experimental support of actively maintained Civetweb to replace Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 endif() |